textsearch

package
v2.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2026 License: AGPL-3.0 Imports: 1 Imported by: 0

Documentation

Overview

Package search defines an interface for a search index management structure

Index

Constants

View Source
const (
	// QueryKeySearch is the query param key to find search queries in requests.
	QueryKeySearch = "q"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Index

type Index[T any] interface {
	IndexSearcher[T]
	IndexManager
}

Index is our wrapper interface for a text search index.

type IndexManager

type IndexManager interface {
	Index(ctx context.Context, id string, value any) error
	Delete(ctx context.Context, id string) (err error)
	Wipe(ctx context.Context) error
}

IndexManager is our wrapper interface for a text search index.

type IndexRequest

type IndexRequest struct {
	RequestID string `json:"id"`
	RowID     string `json:"rowID"`
	IndexType string `json:"type"`
	TestID    string `json:"testID,omitempty"`
	Delete    bool   `json:"delete"`
}

type IndexSearcher

type IndexSearcher[T any] interface {
	Search(ctx context.Context, query string) (ids []*T, err error)
}

type NoopIndexManager

type NoopIndexManager[T any] struct{}

NoopIndexManager is a noop Index.

func (*NoopIndexManager[T]) Delete

Delete is a no-op method.

func (*NoopIndexManager[T]) Index

Index is a no-op method.

func (*NoopIndexManager[T]) Search

func (*NoopIndexManager[T]) Search(context.Context, string) ([]*T, error)

Search is a no-op method.

func (*NoopIndexManager[T]) Wipe

Wipe is a no-op method.

Directories

Path Synopsis
Package algolia provides an interface-compatible wrapper around the algolia indexer
Package algolia provides an interface-compatible wrapper around the algolia indexer
Package elasticsearch provides an interface-compatible wrapper around the elasticsearch indexer
Package elasticsearch provides an interface-compatible wrapper around the elasticsearch indexer
Package mocksearch provides an interface-compatible search index mock
Package mocksearch provides an interface-compatible search index mock

Jump to

Keyboard shortcuts

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