pgvector

package
v0.2.15 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 26, 2026 License: MPL-2.0 Imports: 10 Imported by: 0

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

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

func New(dsn string) (*Store, error)

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.

func (*Store) Close

func (s *Store) Close() error

func (*Store) Delete

func (s *Store) Delete(ctx context.Context, tenant, collection string, ids []string) (int, error)

func (*Store) DescribeCollection

func (s *Store) DescribeCollection(ctx context.Context, tenant, name string) (vector.Collection, bool, error)

func (*Store) EnsureCollection

func (s *Store) EnsureCollection(ctx context.Context, tenant string, c vector.Collection) error

func (*Store) Search

func (s *Store) Search(ctx context.Context, tenant, collection string, query []float32, limit int, filter vector.Filter) ([]vector.Match, error)

func (*Store) Upsert

func (s *Store) Upsert(ctx context.Context, tenant, collection string, items []vector.Item) (int, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL