Versions in this module Expand all Collapse all v0 v0.1.1 Nov 9, 2026 v0.1.0 Nov 9, 2026 Changes in this version + const BooleanValue + const IntegerValue + const KeywordValue + const MaxInteger + var ErrClosed = errors.New("search: closed") + var ErrConflict = errors.New("search: conflict") + var ErrIndexNotFound = errors.New("search: index not found") + var ErrInvalidDefinition = errors.New("search: invalid definition") + var ErrInvalidDocument = errors.New("search: invalid document") + var ErrInvalidQuery = errors.New("search: invalid query") + var ErrInvalidReceipt = errors.New("search: invalid receipt") + var ErrMutationFailed = errors.New("search: mutation failed") + var ErrNotFound = errors.New("search: document not found") + var ErrOutcomeUnknown = errors.New("search: mutation outcome unknown") + var ErrRateLimited = errors.New("search: rate limited") + var ErrReceiptExpired = errors.New("search: receipt expired") + var ErrSchemaDrift = errors.New("search: schema drift") + var ErrUnauthorized = errors.New("search: unauthorized") + var ErrUnavailable = errors.New("search: unavailable") + var ErrUnsupported = errors.New("search: unsupported operation") + func Decode[T any](d Document) (T, error) + func SafeError(err error) error + type AsyncObserver struct + func NewAsyncObserver(observer Observer, capacity int) (*AsyncObserver, error) + func (a *AsyncObserver) Dropped() uint64 + func (a *AsyncObserver) Observe(ctx context.Context, event Event) + func (a *AsyncObserver) Shutdown(ctx context.Context) error + type Backend interface + Bulk func(context.Context, Definition, []Mutation) (BulkResult, error) + Delete func(context.Context, Definition, DocumentID) (Receipt, error) + Search func(context.Context, Definition, Query) (Result, error) + Upsert func(context.Context, Definition, Document) (Receipt, error) + Wait func(context.Context, Receipt) (Outcome, error) + type Bucket struct + Count uint64 + Value Value + type BulkOutcome struct + Items []ItemResult + Precision ItemOutcomePrecision + type BulkResult struct + Items []ItemResult + Precision ItemOutcomePrecision + Receipt Receipt + type CountPrecision string + const CountEstimated + const CountExact + type DecodeError struct + ID DocumentID + func (e *DecodeError) Error() string + func (e *DecodeError) Unwrap() error + type Definition struct + DefaultSearchable []FieldName + DefaultSort []Sort + Fields []Field + Name IndexName + func (d Definition) Fingerprint() (string, error) + func (d Definition) Validate() error + type Direction string + const Ascending + const Descending + type Document struct + Body json.RawMessage + ID DocumentID + func Encode[T any](id DocumentID, value T) (Document, error) + type DocumentID string + type Event struct + DocumentCount int + Duration time.Duration + ErrorCode string + HitCount int + Index IndexName + Kind string + Outcome string + Phase EventPhase + ReceiptID string + TotalRelation TotalRelation + type EventPhase string + const PhaseSearchComplete + const PhaseSubmission + const PhaseTerminal + type FacetResult struct + Buckets []Bucket + Field FieldName + Name string + Precision CountPrecision + Truncated bool + type Field struct + Facetable bool + Filterable bool + Name FieldName + Path JSONPointer + Required bool + Searchable bool + Sortable bool + Type FieldType + type FieldName string + type FieldType string + const BooleanField + const IntegerField + const KeywordField + const KeywordsField + const TextField + type Filter struct + func And(f ...Filter) Filter + func Between(f FieldName, a, b Value) Filter + func ContainsAll(f FieldName, v ...Value) Filter + func ContainsAny(f FieldName, v ...Value) Filter + func Equal(f FieldName, v Value) Filter + func Exists(f FieldName) Filter + func GreaterThan(f FieldName, v Value) Filter + func GreaterThanOrEqual(f FieldName, v Value) Filter + func In(f FieldName, v ...Value) Filter + func LessThan(f FieldName, v Value) Filter + func LessThanOrEqual(f FieldName, v Value) Filter + func Not(f Filter) Filter + func Or(f ...Filter) Filter + func (f Filter) View() FilterView + type FilterKind string + const FilterAnd + const FilterBetween + const FilterContainsAll + const FilterContainsAny + const FilterEqual + const FilterExists + const FilterGreaterThan + const FilterGreaterThanOrEqual + const FilterIn + const FilterLessThan + const FilterLessThanOrEqual + const FilterNot + const FilterOr + type FilterView struct + Children []Filter + Field FieldName + Kind FilterKind + Values []Value + type Fragment struct + Segments []Segment + type Highlight struct + Field FieldName + type Hit struct + Document Document + Highlights map[FieldName][]Fragment + Score *float64 + SortValues []Value + type HitOf struct + Highlights map[FieldName][]Fragment + ID DocumentID + Score *float64 + SortValues []Value + Value T + type Index struct + func NewIndex(b Backend, d Definition, opts ...Option) (*Index, error) + func (i *Index) Bulk(ctx context.Context, ms []Mutation) (BulkResult, error) + func (i *Index) Definition() Definition + func (i *Index) Delete(ctx context.Context, id DocumentID) (Receipt, error) + func (i *Index) Search(ctx context.Context, q Query) (Result, error) + func (i *Index) Upsert(ctx context.Context, d Document) (Receipt, error) + func (i *Index) Wait(ctx context.Context, r Receipt) (Outcome, error) + type IndexName string + type ItemOutcomePrecision string + const BatchOnly + const PerItem + type ItemResult struct + Error error + ID DocumentID + Position int + Status ItemStatus + type ItemStatus string + const ItemAccepted + const ItemFailed + const ItemRejected + const ItemSucceeded + const ItemUnknown + type JSONPointer string + type Limits struct + ArrayLength int + BulkBytes int + BulkDocuments int + DefinitionBytes int + DefinitionFields int + DocumentBytes int + FacetNameBytes int + Facets int + FilterDepth int + FilterNodes int + FilterValueBytes int + FilterValues int + HighlightFields int + JSONDepth int + JSONPointerDepth int + NameBytes int + ObjectMembers int + QueryBytes int + QueryFields int + QueryTerms int + ResultLimit uint64 + ResultWindow uint64 + TextBytes int + func DefaultLimits() Limits + type MultiObserver []Observer + func (m MultiObserver) Observe(ctx context.Context, e Event) + type Mutation struct + func DeleteMutation(id DocumentID) (Mutation, error) + func UpsertMutation(d Document) (Mutation, error) + func (m Mutation) Document() (Document, bool) + func (m Mutation) ID() DocumentID + func (m Mutation) Kind() MutationKind + type MutationKind string + const MutationDelete + const MutationUpsert + type Observer interface + Observe func(context.Context, Event) + type ObserverFunc func(context.Context, Event) + func (f ObserverFunc) Observe(ctx context.Context, e Event) + type Option func(*Index) error + func WithLimits(l Limits) Option + func WithObserver(o Observer) Option + type Outcome struct + Bulk *BulkOutcome + Error error + State OutcomeState + VisibleAt time.Time + type OutcomeState string + const OutcomeFailed + const OutcomeSucceeded + const OutcomeUnknown + type Page struct + Facets []FacetResult + Hits []HitOf[T] + Took time.Duration + Total Total + func SearchAs[T any](ctx context.Context, index *Index, q Query) (Page[T], error) + type Query struct + Facets []TermFacet + Fields []FieldName + Filter Filter + Highlight []Highlight + Limit uint64 + Offset uint64 + Sort []Sort + Text string + type Receipt struct + func NewReceipt(token []byte) (Receipt, error) + func Upsert[T any](ctx context.Context, index *Index, id DocumentID, value T) (Receipt, error) + func (r Receipt) Token() []byte + type Result struct + Facets []FacetResult + Hits []Hit + Took time.Duration + Total Total + type Segment struct + Matched bool + Text string + type Sort struct + Direction Direction + Field FieldName + type TermFacet struct + Field FieldName + Limit uint64 + Name string + type Total struct + Relation TotalRelation + Value uint64 + type TotalRelation string + const TotalEstimated + const TotalExact + const TotalLowerBound + type UnknownOutcomeError struct + func NewUnknownOutcomeError(receipt Receipt) *UnknownOutcomeError + func (e *UnknownOutcomeError) Error() string + func (e *UnknownOutcomeError) Receipt() (Receipt, bool) + func (e *UnknownOutcomeError) Unwrap() error + type Value struct + func Boolean(v bool) Value + func Integer(v int64) (Value, error) + func Keyword(v string) (Value, error) + func (v Value) Boolean() (bool, bool) + func (v Value) Integer() (int64, bool) + func (v Value) Keyword() (string, bool) + func (v Value) Kind() ValueKind + func (v Value) MarshalJSON() ([]byte, error) + type ValueKind string