Enum Class PgVectorStore.DistanceType

java.lang.Object
java.lang.Enum<PgVectorStore.DistanceType>
io.agentscope.core.rag.store.PgVectorStore.DistanceType
All Implemented Interfaces:
Serializable, Comparable<PgVectorStore.DistanceType>, Constable
Enclosing class:
PgVectorStore

public static enum PgVectorStore.DistanceType extends Enum<PgVectorStore.DistanceType>
Distance types supported by pgvector.
  • Enum Constant Details

  • Method Details

    • values

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

      public static PgVectorStore.DistanceType valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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 class has no constant with the specified name
      NullPointerException - if the argument is null
    • getIndexOps

      public String getIndexOps()
      Gets the index operator class name for this distance type.

      This is used when creating HNSW indexes in PostgreSQL with pgvector. For example: CREATE INDEX ... USING hnsw (embedding vector_cosine_ops)

      Returns:
      the index operator class name (e.g., "vector_cosine_ops", "vector_l2_ops")
    • getOperator

      public String getOperator()
      Gets the SQL operator for this distance type.

      This operator is used in ORDER BY clauses to sort results by similarity. For example: ORDER BY embedding <=> query_vector

      Returns:
      the SQL operator (e.g., "<=>" for cosine, "<->" for L2)