searcher

package
v1.0.14 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2020 License: Apache-2.0 Imports: 14 Imported by: 39

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DisjunctionHeapTakeover = 10

DisjunctionHeapTakeover is a compile time setting that applications can adjust to control when the DisjunctionSearcher will switch from a simple slice implementation to a heap implementation.

View Source
var DisjunctionMaxClauseCount = 0

DisjunctionMaxClauseCount is a compile time setting that applications can adjust to non-zero value to cause the DisjunctionSearcher to return an error instead of exeucting searches when the size exceeds this value.

View Source
var GeoBitsShift1 = geo.GeoBits << 1
View Source
var GeoBitsShift1Minus1 = GeoBitsShift1 - 1
View Source
var MaxFuzziness = 2

Functions

func ComputeGeoRange

func ComputeGeoRange(term uint64, shift uint,
	sminLon, sminLat, smaxLon, smaxLat float64, checkBoundaries bool,
	indexReader index.IndexReader, field string) (
	onBoundary [][]byte, notOnBoundary [][]byte, err error)

func NewConjunctionSearcher

func NewConjunctionSearcher(indexReader index.IndexReader,
	qsearchers []search.Searcher, options search.SearcherOptions) (
	search.Searcher, error)

func NewDisjunctionSearcher

func NewDisjunctionSearcher(indexReader index.IndexReader,
	qsearchers []search.Searcher, min float64, options search.SearcherOptions) (
	search.Searcher, error)

func NewFuzzySearcher

func NewFuzzySearcher(indexReader index.IndexReader, term string,
	prefix, fuzziness int, field string, boost float64,
	options search.SearcherOptions) (search.Searcher, error)

func NewGeoBoundedPolygonSearcher added in v0.8.1

func NewGeoBoundedPolygonSearcher(indexReader index.IndexReader,
	polygon []geo.Point, field string, boost float64,
	options search.SearcherOptions) (search.Searcher, error)

func NewGeoBoundingBoxSearcher

func NewGeoBoundingBoxSearcher(indexReader index.IndexReader, minLon, minLat,
	maxLon, maxLat float64, field string, boost float64,
	options search.SearcherOptions, checkBoundaries bool) (
	search.Searcher, error)

func NewGeoPointDistanceSearcher

func NewGeoPointDistanceSearcher(indexReader index.IndexReader, centerLon,
	centerLat, dist float64, field string, boost float64,
	options search.SearcherOptions) (search.Searcher, error)

func NewMultiTermSearcher

func NewMultiTermSearcher(indexReader index.IndexReader, terms []string,
	field string, boost float64, options search.SearcherOptions, limit bool) (
	search.Searcher, error)

func NewMultiTermSearcherBytes

func NewMultiTermSearcherBytes(indexReader index.IndexReader, terms [][]byte,
	field string, boost float64, options search.SearcherOptions, limit bool) (
	search.Searcher, error)

func NewNumericRangeSearcher

func NewNumericRangeSearcher(indexReader index.IndexReader,
	min *float64, max *float64, inclusiveMin, inclusiveMax *bool, field string,
	boost float64, options search.SearcherOptions) (search.Searcher, error)

func NewRegexpSearcher

func NewRegexpSearcher(indexReader index.IndexReader, pattern index.Regexp,
	field string, boost float64, options search.SearcherOptions) (
	search.Searcher, error)

NewRegexpSearcher creates a searcher which will match documents that contain terms which match the pattern regexp. The match must be EXACT matching the entire term. The provided regexp SHOULD NOT start with ^ or end with $ as this can intefere with the implementation. Separately, matches will be checked to ensure they match the entire term.

func NewRegexpStringSearcher added in v0.8.0

func NewRegexpStringSearcher(indexReader index.IndexReader, pattern string,
	field string, boost float64, options search.SearcherOptions) (
	search.Searcher, error)

NewRegexpStringSearcher is similar to NewRegexpSearcher, but additionally optimizes for index readers that handle regexp's.

func NewTermPrefixSearcher

func NewTermPrefixSearcher(indexReader index.IndexReader, prefix string,
	field string, boost float64, options search.SearcherOptions) (
	search.Searcher, error)

func NewTermRangeSearcher

func NewTermRangeSearcher(indexReader index.IndexReader,
	min, max []byte, inclusiveMin, inclusiveMax *bool, field string,
	boost float64, options search.SearcherOptions) (search.Searcher, error)

Types

type BooleanSearcher

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

func NewBooleanSearcher

func NewBooleanSearcher(indexReader index.IndexReader, mustSearcher search.Searcher, shouldSearcher search.Searcher, mustNotSearcher search.Searcher, options search.SearcherOptions) (*BooleanSearcher, error)

func (*BooleanSearcher) Advance

func (*BooleanSearcher) Close

func (s *BooleanSearcher) Close() error

func (*BooleanSearcher) Count

func (s *BooleanSearcher) Count() uint64

func (*BooleanSearcher) DocumentMatchPoolSize

func (s *BooleanSearcher) DocumentMatchPoolSize() int

func (*BooleanSearcher) Min

func (s *BooleanSearcher) Min() int

func (*BooleanSearcher) Next

func (*BooleanSearcher) SetQueryNorm

func (s *BooleanSearcher) SetQueryNorm(qnorm float64)

func (*BooleanSearcher) Size added in v0.8.0

func (s *BooleanSearcher) Size() int

func (*BooleanSearcher) Weight

func (s *BooleanSearcher) Weight() float64

type ConjunctionSearcher

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

func (*ConjunctionSearcher) Advance

func (*ConjunctionSearcher) Close

func (s *ConjunctionSearcher) Close() (rv error)

func (*ConjunctionSearcher) Count

func (s *ConjunctionSearcher) Count() uint64

func (*ConjunctionSearcher) DocumentMatchPoolSize

func (s *ConjunctionSearcher) DocumentMatchPoolSize() int

func (*ConjunctionSearcher) Min

func (s *ConjunctionSearcher) Min() int

func (*ConjunctionSearcher) Next

func (*ConjunctionSearcher) SetQueryNorm

func (s *ConjunctionSearcher) SetQueryNorm(qnorm float64)

func (*ConjunctionSearcher) Size added in v0.8.0

func (s *ConjunctionSearcher) Size() int

func (*ConjunctionSearcher) Weight

func (s *ConjunctionSearcher) Weight() float64

type DisjunctionHeapSearcher added in v0.8.0

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

func (*DisjunctionHeapSearcher) Advance added in v0.8.0

func (*DisjunctionHeapSearcher) Close added in v0.8.0

func (s *DisjunctionHeapSearcher) Close() (rv error)

func (*DisjunctionHeapSearcher) Count added in v0.8.0

func (s *DisjunctionHeapSearcher) Count() uint64

func (*DisjunctionHeapSearcher) DocumentMatchPoolSize added in v0.8.0

func (s *DisjunctionHeapSearcher) DocumentMatchPoolSize() int

func (*DisjunctionHeapSearcher) Len added in v0.8.0

func (s *DisjunctionHeapSearcher) Len() int

func (*DisjunctionHeapSearcher) Less added in v0.8.0

func (s *DisjunctionHeapSearcher) Less(i, j int) bool

func (*DisjunctionHeapSearcher) Min added in v0.8.0

func (s *DisjunctionHeapSearcher) Min() int

func (*DisjunctionHeapSearcher) Next added in v0.8.0

func (*DisjunctionHeapSearcher) Optimize added in v0.8.0

a disjunction searcher implements the index.Optimizable interface but only activates on an edge case where the disjunction is a wrapper around a single Optimizable child searcher

func (*DisjunctionHeapSearcher) Pop added in v0.8.0

func (s *DisjunctionHeapSearcher) Pop() interface{}

func (*DisjunctionHeapSearcher) Push added in v0.8.0

func (s *DisjunctionHeapSearcher) Push(x interface{})

func (*DisjunctionHeapSearcher) SetQueryNorm added in v0.8.0

func (s *DisjunctionHeapSearcher) SetQueryNorm(qnorm float64)

func (*DisjunctionHeapSearcher) Size added in v0.8.0

func (s *DisjunctionHeapSearcher) Size() int

func (*DisjunctionHeapSearcher) Swap added in v0.8.0

func (s *DisjunctionHeapSearcher) Swap(i, j int)

func (*DisjunctionHeapSearcher) Weight added in v0.8.0

func (s *DisjunctionHeapSearcher) Weight() float64

type DisjunctionSliceSearcher added in v0.8.0

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

func (*DisjunctionSliceSearcher) Advance added in v0.8.0

func (*DisjunctionSliceSearcher) Close added in v0.8.0

func (s *DisjunctionSliceSearcher) Close() (rv error)

func (*DisjunctionSliceSearcher) Count added in v0.8.0

func (s *DisjunctionSliceSearcher) Count() uint64

func (*DisjunctionSliceSearcher) DocumentMatchPoolSize added in v0.8.0

func (s *DisjunctionSliceSearcher) DocumentMatchPoolSize() int

func (*DisjunctionSliceSearcher) Min added in v0.8.0

func (s *DisjunctionSliceSearcher) Min() int

func (*DisjunctionSliceSearcher) Next added in v0.8.0

func (*DisjunctionSliceSearcher) Optimize added in v0.8.0

a disjunction searcher implements the index.Optimizable interface but only activates on an edge case where the disjunction is a wrapper around a single Optimizable child searcher

func (*DisjunctionSliceSearcher) SetQueryNorm added in v0.8.0

func (s *DisjunctionSliceSearcher) SetQueryNorm(qnorm float64)

func (*DisjunctionSliceSearcher) Size added in v0.8.0

func (s *DisjunctionSliceSearcher) Size() int

func (*DisjunctionSliceSearcher) Weight added in v0.8.0

func (s *DisjunctionSliceSearcher) Weight() float64

type DocIDSearcher

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

DocIDSearcher returns documents matching a predefined set of identifiers.

func NewDocIDSearcher

func NewDocIDSearcher(indexReader index.IndexReader, ids []string, boost float64,
	options search.SearcherOptions) (searcher *DocIDSearcher, err error)

func (*DocIDSearcher) Advance

func (*DocIDSearcher) Close

func (s *DocIDSearcher) Close() error

func (*DocIDSearcher) Count

func (s *DocIDSearcher) Count() uint64

func (*DocIDSearcher) DocumentMatchPoolSize

func (s *DocIDSearcher) DocumentMatchPoolSize() int

func (*DocIDSearcher) Min

func (s *DocIDSearcher) Min() int

func (*DocIDSearcher) Next

func (*DocIDSearcher) SetQueryNorm

func (s *DocIDSearcher) SetQueryNorm(qnorm float64)

func (*DocIDSearcher) Size added in v0.8.0

func (s *DocIDSearcher) Size() int

func (*DocIDSearcher) Weight

func (s *DocIDSearcher) Weight() float64

type FilterFunc

type FilterFunc func(d *search.DocumentMatch) bool

FilterFunc defines a function which can filter documents returning true means keep the document returning false means do not keep the document

type FilteringSearcher

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

FilteringSearcher wraps any other searcher, but checks any Next/Advance call against the supplied FilterFunc

func NewFilteringSearcher

func NewFilteringSearcher(s search.Searcher, filter FilterFunc) *FilteringSearcher

func (*FilteringSearcher) Advance

func (*FilteringSearcher) Close

func (f *FilteringSearcher) Close() error

func (*FilteringSearcher) Count

func (f *FilteringSearcher) Count() uint64

func (*FilteringSearcher) DocumentMatchPoolSize

func (f *FilteringSearcher) DocumentMatchPoolSize() int

func (*FilteringSearcher) Min

func (f *FilteringSearcher) Min() int

func (*FilteringSearcher) Next

func (*FilteringSearcher) SetQueryNorm

func (f *FilteringSearcher) SetQueryNorm(n float64)

func (*FilteringSearcher) Size added in v0.8.0

func (f *FilteringSearcher) Size() int

func (*FilteringSearcher) Weight

func (f *FilteringSearcher) Weight() float64

type MatchAllSearcher

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

func NewMatchAllSearcher

func NewMatchAllSearcher(indexReader index.IndexReader, boost float64, options search.SearcherOptions) (*MatchAllSearcher, error)

func (*MatchAllSearcher) Advance

func (*MatchAllSearcher) Close

func (s *MatchAllSearcher) Close() error

func (*MatchAllSearcher) Count

func (s *MatchAllSearcher) Count() uint64

func (*MatchAllSearcher) DocumentMatchPoolSize

func (s *MatchAllSearcher) DocumentMatchPoolSize() int

func (*MatchAllSearcher) Min

func (s *MatchAllSearcher) Min() int

func (*MatchAllSearcher) Next

func (*MatchAllSearcher) SetQueryNorm

func (s *MatchAllSearcher) SetQueryNorm(qnorm float64)

func (*MatchAllSearcher) Size added in v0.8.0

func (s *MatchAllSearcher) Size() int

func (*MatchAllSearcher) Weight

func (s *MatchAllSearcher) Weight() float64

type MatchNoneSearcher

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

func NewMatchNoneSearcher

func NewMatchNoneSearcher(indexReader index.IndexReader) (*MatchNoneSearcher, error)

func (*MatchNoneSearcher) Advance

func (*MatchNoneSearcher) Close

func (s *MatchNoneSearcher) Close() error

func (*MatchNoneSearcher) Count

func (s *MatchNoneSearcher) Count() uint64

func (*MatchNoneSearcher) DocumentMatchPoolSize

func (s *MatchNoneSearcher) DocumentMatchPoolSize() int

func (*MatchNoneSearcher) Min

func (s *MatchNoneSearcher) Min() int

func (*MatchNoneSearcher) Next

func (*MatchNoneSearcher) SetQueryNorm

func (s *MatchNoneSearcher) SetQueryNorm(qnorm float64)

func (*MatchNoneSearcher) Size added in v0.8.0

func (s *MatchNoneSearcher) Size() int

func (*MatchNoneSearcher) Weight

func (s *MatchNoneSearcher) Weight() float64

type OrderedSearcherList

type OrderedSearcherList []search.Searcher

func (OrderedSearcherList) Len

func (otrl OrderedSearcherList) Len() int

func (OrderedSearcherList) Less

func (otrl OrderedSearcherList) Less(i, j int) bool

func (OrderedSearcherList) Swap

func (otrl OrderedSearcherList) Swap(i, j int)

type PhraseSearcher

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

func NewMultiPhraseSearcher

func NewMultiPhraseSearcher(indexReader index.IndexReader, terms [][]string, field string, options search.SearcherOptions) (*PhraseSearcher, error)

func NewPhraseSearcher

func NewPhraseSearcher(indexReader index.IndexReader, terms []string, field string, options search.SearcherOptions) (*PhraseSearcher, error)

func (*PhraseSearcher) Advance

func (*PhraseSearcher) Close

func (s *PhraseSearcher) Close() error

func (*PhraseSearcher) Count

func (s *PhraseSearcher) Count() uint64

func (*PhraseSearcher) DocumentMatchPoolSize

func (s *PhraseSearcher) DocumentMatchPoolSize() int

func (*PhraseSearcher) Min

func (s *PhraseSearcher) Min() int

func (*PhraseSearcher) Next

func (*PhraseSearcher) SetQueryNorm

func (s *PhraseSearcher) SetQueryNorm(qnorm float64)

func (*PhraseSearcher) Size added in v0.8.0

func (s *PhraseSearcher) Size() int

func (*PhraseSearcher) Weight

func (s *PhraseSearcher) Weight() float64

type SearcherCurr added in v0.8.0

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

type TermSearcher

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

func NewTermSearcher

func NewTermSearcher(indexReader index.IndexReader, term string, field string, boost float64, options search.SearcherOptions) (*TermSearcher, error)

func NewTermSearcherBytes

func NewTermSearcherBytes(indexReader index.IndexReader, term []byte, field string, boost float64, options search.SearcherOptions) (*TermSearcher, error)

func (*TermSearcher) Advance

func (*TermSearcher) Close

func (s *TermSearcher) Close() error

func (*TermSearcher) Count

func (s *TermSearcher) Count() uint64

func (*TermSearcher) DocumentMatchPoolSize

func (s *TermSearcher) DocumentMatchPoolSize() int

func (*TermSearcher) Min

func (s *TermSearcher) Min() int

func (*TermSearcher) Next

func (*TermSearcher) Optimize added in v0.8.0

func (*TermSearcher) SetQueryNorm

func (s *TermSearcher) SetQueryNorm(qnorm float64)

func (*TermSearcher) Size added in v0.8.0

func (s *TermSearcher) Size() int

func (*TermSearcher) Weight

func (s *TermSearcher) Weight() float64

Jump to

Keyboard shortcuts

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