Enum Class PgVectorStore.PgIndexType

java.lang.Object
java.lang.Enum<PgVectorStore.PgIndexType>
org.springframework.ai.vectorstore.PgVectorStore.PgIndexType
All Implemented Interfaces:
Serializable, Comparable<PgVectorStore.PgIndexType>, Constable
Enclosing class:
PgVectorStore

public static enum PgVectorStore.PgIndexType extends Enum<PgVectorStore.PgIndexType>
By default, pgvector performs exact nearest neighbor search, which provides perfect recall. You can add an index to use approximate nearest neighbor search, which trades some recall for speed. Unlike typical indexes, you will see different results for queries after adding an approximate index.
  • Enum Constant Details

    • NONE

      public static final PgVectorStore.PgIndexType NONE
      Performs exact nearest neighbor search, which provides perfect recall.
    • IVFFLAT

      public static final PgVectorStore.PgIndexType IVFFLAT
      An IVFFlat index divides vectors into lists, and then searches a subset of those lists that are closest to the query vector. It has faster build times and uses less memory than HNSW, but has lower query performance (in terms of speed-recall tradeoff).
    • HNSW

      public static final PgVectorStore.PgIndexType HNSW
      An HNSW index creates a multilayer graph. It has slower build times and uses more memory than IVFFlat, but has better query performance (in terms of speed-recall tradeoff). There’s no training step like IVFFlat, so the index can be created without any data in the table.
  • Method Details

    • values

      public static PgVectorStore.PgIndexType[] 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.PgIndexType 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