Class VectorQueryOptions.Builder

java.lang.Object
com.google.cloud.firestore.VectorQueryOptions.Builder
Enclosing class:
VectorQueryOptions

public static final class VectorQueryOptions.Builder extends Object
  • Method Details

    • setDistanceResultField

      public VectorQueryOptions.Builder setDistanceResultField(@Nullable 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`.
      Parameters:
      fieldPath - A string value specifying the distance result field.
    • setDistanceResultField

      public VectorQueryOptions.Builder setDistanceResultField(@Nullable 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`.
      Parameters:
      fieldPath - A FieldPath value specifying the distance result field.
    • setDistanceThreshold

      public VectorQueryOptions.Builder setDistanceThreshold(@Nullable 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`.

      Parameters:
      distanceThreshold - A Double value specifying the distance threshold.
    • build

      public VectorQueryOptions build()