Documentation
¶
Overview ¶
Package pgvector is the HA/scale vector.Store backend: PostgreSQL + the pgvector extension, for deployments where multiple chassis nodes share one durable vector store (the same trigger that sends the auth DB to Postgres).
**No Postgres driver is imported here.** Like the auth registry, this package uses database/sql with the driver *name* "pgx"; the actual driver is blank-imported by the overlay/production build, never by the open-core chassis (SQLite stays the only in-tree driver). pgvector is entirely server-side SQL — vectors travel as text literals cast to ::vector — so no pgx-specific Go API is needed.
**v1 is exact, not approximate.** Each collection is a table with a vector(N) column; search ranks with the cosine-distance operator (`<=>`) over an exact scan and pushes metadata/id filters into the WHERE before ranking. That already delivers the shared-store HA value. An HNSW index per collection is the one-line scale optimisation for >~100k vectors and is deliberately deferred (correct-not-optimized).
Index ¶
- type Store
- func (s *Store) Close() error
- func (s *Store) Delete(ctx context.Context, tenant, collection string, ids []string) (int, error)
- func (s *Store) DescribeCollection(ctx context.Context, tenant, name string) (vector.Collection, bool, error)
- func (s *Store) EnsureCollection(ctx context.Context, tenant string, c vector.Collection) error
- func (s *Store) Search(ctx context.Context, tenant, collection string, query []float32, limit int, ...) ([]vector.Match, error)
- func (s *Store) Upsert(ctx context.Context, tenant, collection string, items []vector.Item) (int, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is the pgvector-backed vector.Store.
func New ¶
New connects to the Postgres at dsn (driver name "pgx"; the driver must be registered by the build — the open-core chassis does not register it), ensures the pgvector extension and the collections metadata table exist.