search

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2020 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// AvailableSearchLangs are languages mapped to their analyzer names.
	AvailableSearchLangs = map[string]string{
		"de": de.AnalyzerName,
		"en": en.AnalyzerName,
	}
)

Functions

func NewIndexes

func NewIndexes(path string, lang string, isPersistent bool) (bleve.Index, bleve.Index, error)

func NewSearchMapping

func NewSearchMapping(lang string, isWide bool) *mapping.IndexMappingImpl

Types

type FullSearchHit

type FullSearchHit struct {
	Node      *ddt.Node
	Fragments []string
}
type Search struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Search provides facilities for differnt kinds of search purposes. It allows to perform full text searching through FullSearch(), wrapping a bleve search index and to perform filtering through FilterSearch().

func NewSearch

func NewSearch(path string, t *ddt.Tree, lang string, isPersistent bool) (*Search, error)

NewSearch constructs and initializes a Search. The selected language is validated and checked for availability.

func (*Search) Close

func (s *Search) Close() error

func (*Search) FilterSearch

func (s *Search) FilterSearch(q string) ([]*ddt.Node, int, time.Duration, bool, error)

FilterSearch performs a narrow restricted prefix search on the node's visible attributes (the title) plus tags using the narrow index by default. Returns a slice of found unique Nodes.

func (*Search) FullSearch

func (s *Search) FullSearch(q string) ([]*FullSearchHit, int, time.Duration, bool, error)

FullSearch performs a full text search over all possible attributes of each node using the wide index. Returns a slice of FullSearchHits.

func (*Search) IndexNode

func (s *Search) IndexNode(n *ddt.Node, wideBatch, narrowBatch *bleve.Batch) error

func (*Search) IndexTree

func (s *Search) IndexTree() error

func (*Search) IsStale

func (s *Search) IsStale() bool

func (*Search) LegacyFilterSearch

func (s *Search) LegacyFilterSearch(q string) ([]*ddt.Node, int, time.Duration, error)

LegacyFilterSearch performs a narrow restricted haystack/needle search on the node's visible attributes (the title) plus tags & keywords.

A new filter search has been introduced for APIv2, which we can't simply switch into a APIv1 backwards compatible maintaining mode.

func (*Search) Refresh

func (s *Search) Refresh() error

Jump to

Keyboard shortcuts

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