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

indexing

package
v1.19.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package indexing holds the in-process pieces shared by the in-memory search and vector components: the portable filter evaluator and the write acknowledgement model.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Apply

func Apply(ctx context.Context, opts search.IndexingOptions, delay time.Duration, write func()) (search.IndexAck, error)

Apply validates opts and applies write. With no delay the write is applied before Apply returns and the acknowledgement is IndexAckCompleted. With a delay the write is queued and applied in the background once delay has passed, which makes IndexAckQueued and wait timeouts observable: a wait for completion that expires either fails with DEADLINE_EXCEEDED or reports IndexAckQueued, and the queued write still lands.

ponytail: queued writes are not tracked, so Close does not wait for them. Track them if the delay is ever used outside development and tests.

func Compare

func Compare(a, b any) (c int, ok bool)

Compare orders two values of the same JSON type: numbers numerically, strings lexically and booleans false before true. An explicit null equals only null. ok is false when the values are of different types or not comparable.

func CtxErr

func CtxErr(ctx context.Context) error

CtxErr returns the context's error as a status error, or nil.

func Lookup

func Lookup(fields map[string]any, path string) (any, bool)

Lookup resolves a dotted field path through nested objects.

Types

type Predicate

type Predicate func(fields map[string]any) bool

Predicate reports whether a document's fields satisfy a compiled filter.

func CompileFilter

func CompileFilter(filter map[string]any) (Predicate, error)

CompileFilter compiles a portable filter expression. The whole expression is validated up front, so an invalid filter is rejected whatever the data. Errors are INVALID_ARGUMENT status errors.

Jump to

Keyboard shortcuts

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