Documentation
¶
Overview ¶
Package cockroachdb provides a native CockroachDB vector-store adapter over pgwire. It uses CockroachDB's built-in VECTOR type, pgvector-compatible distance operators, and native VECTOR INDEX declaration.
Requirements: CockroachDB v25.4 or later is recommended for generally available vector indexing. Schema initialization is explicit through StoreConfig.InitializeSchema.
Index ¶
- Constants
- type DistanceMetric
- type Store
- func (s *Store) Close() error
- func (s *Store) DeleteIDs(ctx context.Context, ids []string) error
- func (s *Store) DeleteWhere(ctx context.Context, predicate filter.Predicate) error
- func (s *Store) Index(ctx context.Context, request *vectorstore.IndexRequest) error
- func (s *Store) Search(ctx context.Context, request *vectorstore.SearchRequest) (*vectorstore.SearchResponse, error)
- type StoreConfig
Constants ¶
View Source
const ( DefaultSchemaName = "public" DefaultTableName = "vector_store" DefaultMetadataColumn = "metadata" DefaultIndexSuffix = "_embedding_idx" )
View Source
const Provider = "CockroachDB"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DistanceMetric ¶
type DistanceMetric string
DistanceMetric selects both the pgvector-compatible query operator and the native CockroachDB vector-index opclass.
const ( DistanceCosine DistanceMetric = "cosine" DistanceL2 DistanceMetric = "l2" DistanceIP DistanceMetric = "ip" )
func (DistanceMetric) String ¶
func (d DistanceMetric) String() string
func (DistanceMetric) Valid ¶
func (d DistanceMetric) Valid() bool
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store implements vector-store capabilities with CockroachDB's native VECTOR type and vector indexes.
func (*Store) DeleteWhere ¶
func (*Store) Index ¶
func (s *Store) Index(ctx context.Context, request *vectorstore.IndexRequest) error
func (*Store) Search ¶
func (s *Store) Search(ctx context.Context, request *vectorstore.SearchRequest) (*vectorstore.SearchResponse, error)
type StoreConfig ¶
type StoreConfig struct {
Pool *pgxpool.Pool
SchemaName string
TableName string
IndexName string
MetadataColumn string
EmbeddingModel embedding.Model
DocumentBatcher vectorstore.Batcher
Dimensions int
DistanceMetric DistanceMetric
InitializeSchema bool
}
func (StoreConfig) Validate ¶
func (s StoreConfig) Validate() error
Click to show internal directories.
Click to hide internal directories.