indexutil

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clone

func Clone(item *retrieval.Result) *retrieval.Result

Clone returns a result whose embedding and canonical JSON metadata containers do not alias stored state. Nested map[string]any objects and []any arrays are cloned recursively. Typed containers such as map[string]string retain their original value semantics and are outside this isolation guarantee.

func IsJSONNumber added in v0.9.0

func IsJSONNumber(value any) bool

IsJSONNumber reports whether value is one of the accepted numeric filter types. It assumes ValidateFilter has already accepted the value.

func MatchesFilter added in v0.9.0

func MatchesFilter(item *retrieval.Result, filter map[string]any) bool

MatchesFilter reports whether item matches every filter entry. Callers must validate the filter first with ValidateFilter.

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

Search copies, filters, scores, and limits an in-memory candidate set.

func ValidateDocumentID added in v0.9.0

func ValidateDocumentID(documentID string) error

ValidateDocumentID rejects empty or whitespace-only document identifiers.

func ValidateFilter added in v0.9.0

func ValidateFilter(filter map[string]any) error

ValidateFilter enforces the backend-independent JSON-scalar filter contract.

func ValidateReplacements added in v0.9.0

func ValidateReplacements(replacements []indexcontract.DocumentReplacement) error

ValidateReplacements enforces the document-replacement batch invariants shared by every built-in Index implementation.

Types

type Space added in v0.9.0

type Space struct {
	Identity    string
	IdentitySet bool
	Dimension   int
}

Space is the reset-only identity and embedding-dimension latch shared by Index implementations. IdentitySet distinguishes an unestablished identity from an established empty identity.

func (Space) ValidateQuery added in v0.9.0

func (s Space) ValidateQuery(query indexcontract.IndexQuery) error

ValidateQuery rejects reads against a different established index space.

func (Space) ValidateResults added in v0.9.0

func (s Space) ValidateResults(items []*retrieval.Result) (Space, error)

ValidateResults returns the space produced by accepting items. The receiver is unchanged when validation fails. The first non-nil result establishes the identity, and the first result with an embedding establishes the dimension.

Jump to

Keyboard shortcuts

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