postgres

package
v2.14.0 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2026 License: Apache-2.0 Imports: 17 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PGVector

type PGVector struct {
	// contains filtered or unexported fields
}

func NewPGVector

func NewPGVector(db *sqlx.DB, config PGVectorConfig) (*PGVector, error)

func (*PGVector) CheckSchema added in v2.5.2

func (pv *PGVector) CheckSchema(ctx context.Context) error

func (*PGVector) Clear

func (pv *PGVector) Clear(ctx context.Context) error

func (*PGVector) Delete

func (pv *PGVector) Delete(ctx context.Context, postIDs []string) error

func (*PGVector) DeleteOrphaned

func (pv *PGVector) DeleteOrphaned(ctx context.Context, nowTime, batchSize int64) (int64, error)

DeleteOrphaned removes embeddings whose posts no longer exist or are soft-deleted past retention.

func (*PGVector) FinalizeBulkIndex

func (pv *PGVector) FinalizeBulkIndex(ctx context.Context) error

FinalizeBulkIndex rebuilds the ANN index (same DDL as the constructor). Drops a same-named wrong/invalid leftover first so IF NOT EXISTS cannot keep it. Uses a pinned connection with statement_timeout=0; querying via pv.db while holding it would self-deadlock on a one-conn pool.

func (*PGVector) PrepareBulkIndex

func (pv *PGVector) PrepareBulkIndex(ctx context.Context) error

PrepareBulkIndex drops the ANN index for bulk load. Keeps post_id B-tree (needed by catch-up's NOT EXISTS).

func (*PGVector) Search

func (pv *PGVector) Search(ctx context.Context, embedding []float32, opts embeddings.SearchOptions) ([]embeddings.SearchResult, error)

func (*PGVector) Store

func (pv *PGVector) Store(ctx context.Context, docs []embeddings.PostDocument, embeddings [][]float32) error

func (*PGVector) VectorIndexExists

func (pv *PGVector) VectorIndexExists(ctx context.Context) (bool, error)

VectorIndexExists is true only for a valid index with the expected definition.

type PGVectorConfig

type PGVectorConfig struct {
	Dimensions int `json:"dimensions"`

	// HNSWM and VectorElementType are applied after unmarshalling
	// vectorStore.parameters so a stale parameters blob cannot override the
	// top-level config fields.
	HNSWM             int    `json:"-"`
	VectorElementType string `json:"-"`

	// SkipVectorIndex: skip constructor CREATE while a deferred reindex owns
	// the lifecycle (avoids sync rebuild of an intentionally dropped index).
	SkipVectorIndex bool `json:"-"`
}

Jump to

Keyboard shortcuts

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