Documentation
¶
Overview ¶
Package search is togo's full-text search subsystem. The default driver is ParadeDB (Postgres BM25; it degrades to a portable SQL ILIKE search so dev on SQLite works too). Elasticsearch, OpenSearch, etc. ship as driver plugins that call search.RegisterDriver and depend on this package.
Install: `togo install togo-framework/search`.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterDriver ¶
func RegisterDriver(name string, f DriverFactory)
RegisterDriver registers a search driver by name (call from a plugin init()).
Types ¶
type DriverFactory ¶
DriverFactory builds a Searcher from the kernel.
type Hit ¶
type Hit struct {
ID string `json:"id"`
Score float64 `json:"score"`
Doc map[string]any `json:"doc"`
}
Hit is a single search result.
type Searcher ¶
type Searcher interface {
Index(ctx context.Context, index, id string, doc map[string]any) error
Search(ctx context.Context, index, query string, limit int) ([]Hit, error)
Delete(ctx context.Context, index, id string) error
}
Searcher indexes and queries documents grouped by index name.
Click to show internal directories.
Click to hide internal directories.