Class VectorQueryOptions.Builder (3.27.2)

public static final class VectorQueryOptions.Builder

Inheritance

java.lang.Object > VectorQueryOptions.Builder

Methods

build()

public VectorQueryOptions build()
Returns
Type Description
VectorQueryOptions

setDistanceResultField(FieldPath fieldPath)

public VectorQueryOptions.Builder setDistanceResultField(FieldPath fieldPath)

Specifies the name of the field that will be set on each returned DocumentSnapshot, which will contain the computed distance for the document. If null, then the computed distance will not be returned. Default value: null.

Parameter
Name Description
fieldPath FieldPath

A FieldPath value specifying the distance result field.

Returns
Type Description
VectorQueryOptions.Builder

setDistanceResultField(String fieldPath)

public VectorQueryOptions.Builder setDistanceResultField(String fieldPath)

Specifies the name of the field that will be set on each returned DocumentSnapshot, which will contain the computed distance for the document. If null, then the computed distance will not be returned. Default value: null.

Parameter
Name Description
fieldPath String

A string value specifying the distance result field.

Returns
Type Description
VectorQueryOptions.Builder

setDistanceThreshold(Double distanceThreshold)

public VectorQueryOptions.Builder setDistanceThreshold(Double distanceThreshold)

Specifies a threshold for which no less similar documents will be returned. The behavior of the specified distanceMeasure will affect the meaning of the distance threshold.

  • For distanceMeasure: "EUCLIDEAN", the meaning of distanceThreshold is: SELECT docs WHERE euclidean_distance <= distanceThreshold
  • For distanceMeasure: "COSINE", the meaning of distanceThreshold is: SELECT docs WHERE cosine_distance <= distanceThreshold
  • For distanceMeasure: "DOT_PRODUCT", the meaning of distanceThreshold is: SELECT docs WHERE dot_product_distance >= distanceThreshold

If null, then the computed distance will not be returned. Default value: null.

Parameter
Name Description
distanceThreshold Double

A Double value specifying the distance threshold.

Returns
Type Description
VectorQueryOptions.Builder