search

package
v0.0.0-...-94c2bb5 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2026 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultSearch = &NopSearch{}

DefaultSearch is the default search engine implementation.

Functions

func Register

func Register(name string, engine Searcher)

func Unregister

func Unregister(name string)

Types

type Config

type Config struct {
	Host     string
	User     string
	Password string
	Timeout  time.Duration
}

type IndexConfig

type IndexConfig struct {
	Index                string
	PrimaryKey           string
	SearchableAttributes []string
	SortableAttributes   []string
	FilterableAttributes []interface{}
	Properties           interface{}
}

type NopSearch

type NopSearch struct{}

NopSearch is a no-op implementation of the Search interface.

func (*NopSearch) Add

func (n *NopSearch) Add(index string, primaryKey *string, docs ...interface{}) error

Add implements the search engine interface by doing nothing (no-op pattern) index: the name of the index to add documents to (ignored) primaryKey: the primary key identifier (ignored) docs: documents to add (ignored) Returns nil as this is a no-op implementation

func (*NopSearch) Delete

func (m *NopSearch) Delete(index string, ids ...string) error

Delete is a no-op implementation that does nothing and always returns nil. It satisfies the Search interface requirement for deleting documents from an index.

func (*NopSearch) Flush

func (n *NopSearch) Flush() error

Flush is a no-op implementation of the Search interface's Flush method.

func (*NopSearch) InitIndex

func (m *NopSearch) InitIndex(cfg *IndexConfig) error

InitIndex initializes the search index with the given configuration. This is a no-op implementation that always returns nil.

func (*NopSearch) Search

func (n *NopSearch) Search(index string, keywords string, options *SearchRequest) (int64, []echo.H, error)

Search implements a no-operation search that returns empty results. It returns zero count, nil results, and nil error for any input.

func (*NopSearch) Update

func (m *NopSearch) Update(index string, primaryKey *string, docs ...interface{}) error

Update is a no-op implementation of the search engine update method. It takes an index name, optional primary key, and documents to update, but performs no actual operation and always returns nil.

type SearchRequest

type SearchRequest struct {
	SearchType   string
	Offset       int64
	Limit        int64
	Filter       interface{}
	StartTime    time.Time
	EndTime      time.Time
	SortFields   []string
	SearchFields []string
}

type Searcher

type Searcher interface {
	Add(index string, primaryKey *string, docs ...interface{}) error
	Update(index string, primaryKey *string, docs ...interface{}) error
	Delete(index string, ids ...string) error
	Flush() error
	InitIndex(cfg *IndexConfig) error
	Search(index string, keywords string, options *SearchRequest) (int64, []echo.H, error)
}

func Get

func Get(name string) Searcher

Directories

Path Synopsis
driver

Jump to

Keyboard shortcuts

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