Help us shape the future of Go! Take the 2026 Go Developer Survey

postgres

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package postgres provides a PostgreSQL pgvector-backed Reliquary index.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Table string
}

Config controls PostgreSQL index storage. Migrate must be called explicitly before the index is used.

type Index

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

Index stores retrieval candidates in a caller-owned PostgreSQL pool.

func New

func New(pool *pgxpool.Pool, cfg Config) (*Index, error)

New validates configuration without connecting or performing migrations.

func (*Index) DeleteDocument

func (i *Index) DeleteDocument(ctx context.Context, documentID string) error

DeleteDocument transactionally removes all results for a document.

func (*Index) Migrate

func (i *Index) Migrate(ctx context.Context) error

Migrate idempotently creates retrieval-owned PostgreSQL schema. It is never called implicitly by New or data operations.

func (*Index) ReplaceDocuments added in v0.9.0

func (i *Index) ReplaceDocuments(ctx context.Context, replacements []indexcontract.DocumentReplacement) error

ReplaceDocuments atomically replaces complete document revisions. The table lock serializes retained-corpus dimension and identity discovery with all other writers.

func (*Index) Reset

func (i *Index) Reset(ctx context.Context) error

Reset destructively removes all indexed results.

func (*Index) Search

func (i *Index) Search(ctx context.Context, query indexcontract.IndexQuery) ([]*retrieval.Result, error)

Search retrieves candidates in PostgreSQL and performs final Reliquary scoring. Text-only queries read every filter-matching row before lexical ranking, so their read and memory cost grows with the matching corpus. Vector queries retain the SQL candidate bound.

func (*Index) Upsert

func (i *Index) Upsert(ctx context.Context, items []*retrieval.Result) error

Upsert transactionally inserts or overwrites results by ID.

Jump to

Keyboard shortcuts

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