Enum VectorQuery.DistanceMeasure

java.lang.Object
java.lang.Enum<VectorQuery.DistanceMeasure>
com.google.cloud.firestore.VectorQuery.DistanceMeasure
All Implemented Interfaces:
Serializable, Comparable<VectorQuery.DistanceMeasure>
Enclosing class:
VectorQuery

public static enum VectorQuery.DistanceMeasure extends Enum<VectorQuery.DistanceMeasure>
The distance measure to use when comparing vectors in a VectorQuery.
See Also:
  • Enum Constant Details

    • COSINE

      public static final VectorQuery.DistanceMeasure COSINE
      COSINE distance compares vectors based on the angle between them, which allows you to measure similarity that isn't based on the vectors' magnitude. We recommend using DOT_PRODUCT with unit normalized vectors instead of COSINE distance, which is mathematically equivalent with better performance.
    • EUCLIDEAN

      public static final VectorQuery.DistanceMeasure EUCLIDEAN
      Measures the EUCLIDEAN distance between the vectors.
    • DOT_PRODUCT

      public static final VectorQuery.DistanceMeasure DOT_PRODUCT
      Similar to cosine but is affected by the magnitude of the vectors.
  • Method Details

    • values

      public static VectorQuery.DistanceMeasure[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static VectorQuery.DistanceMeasure valueOf(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null