search

package
v1.4.3 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2024 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BleveSearch

type BleveSearch struct {
	// contains filtered or unexported fields
}

NewBleveSearch is used to represent internals of bleve.

func NewBleveSearch

func NewBleveSearch(dbPath string) (*BleveSearch, error)

NewBleveSearch constructs a new bleve search engine.

func (*BleveSearch) Close

func (b *BleveSearch) Close() error

Close the index.

func (*BleveSearch) Delete added in v1.4.0

func (b *BleveSearch) Delete(key string) error

Delete an item from the index.

func (*BleveSearch) Index

func (b *BleveSearch) Index(item IndexItem) error

Index an item

func (*BleveSearch) Search

func (b *BleveSearch) Search(ctx context.Context, query string, size, currentPage int, searchType Type, fieldScope string) ([]string, error)

Search prepares the query and searches in bleve.

type IndexItem

type IndexItem struct {
	ChannelHash string
	Hash        string
	Type        int32
	Name        string
	Description string
}

IndexItem represents the indexable structure.

type IndexSearcher

type IndexSearcher interface {
	Index(item IndexItem) error
	Search(ctx context.Context, query string, size, currentPage int, searchType Type, fieldScope string) ([]string, error)
	Delete(key string) error
	Close() error
}

IndexSearcher provides searching and indexing functionality.

type Search struct {
	// contains filtered or unexported fields
}

Search implements full-text searching and indexing.

func New

func New(engine IndexSearcher) (*Search, error)

New constructs a new search.

func (*Search) Close

func (s *Search) Close() error

Close implements closing the db.

func (*Search) Delete added in v1.4.0

func (s *Search) Delete(key string) error

Delete implements a delete from the search index.

func (*Search) Index

func (s *Search) Index(item IndexItem) error

Index implements a indexing.

func (*Search) Search

func (s *Search) Search(ctx context.Context, query string, size, currentPage int, searchType Type, fieldScope string) ([]string, error)

Search implements a searching.

type Type

type Type string

Type defines the type of search available.

const (
	// AllTermRequired search.
	AllTermRequired Type = "all"
	// AnyTermRequired search.
	AnyTermRequired Type = "any"
)

Jump to

Keyboard shortcuts

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