Documentation
¶
Index ¶
- type PGVector
- func (pv *PGVector) CheckSchema(ctx context.Context) error
- func (pv *PGVector) Clear(ctx context.Context) error
- func (pv *PGVector) Delete(ctx context.Context, postIDs []string) error
- func (pv *PGVector) DeleteOrphaned(ctx context.Context, nowTime, batchSize int64) (int64, error)
- func (pv *PGVector) FinalizeBulkIndex(ctx context.Context) error
- func (pv *PGVector) PrepareBulkIndex(ctx context.Context) error
- func (pv *PGVector) Search(ctx context.Context, embedding []float32, opts embeddings.SearchOptions) ([]embeddings.SearchResult, error)
- func (pv *PGVector) Store(ctx context.Context, docs []embeddings.PostDocument, embeddings [][]float32) error
- func (pv *PGVector) VectorIndexExists(ctx context.Context) (bool, error)
- type PGVectorConfig
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 (*PGVector) DeleteOrphaned ¶
DeleteOrphaned removes embeddings whose posts no longer exist or are soft-deleted past retention.
func (*PGVector) FinalizeBulkIndex ¶
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 ¶
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
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:"-"`
}
Click to show internal directories.
Click to hide internal directories.