search

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2023 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultSearch = &NopSearch{}

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 []string
	Properties           interface{}
}

type NopSearch

type NopSearch struct{}

func (*NopSearch) Add

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

func (*NopSearch) Delete

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

func (*NopSearch) Flush

func (n *NopSearch) Flush() error

func (*NopSearch) InitIndex

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

func (*NopSearch) Search

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

func (*NopSearch) Update

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

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