Documentation ¶
Index ¶
- Constants
- Variables
- func LevenshteinDistance(a, b string) int
- func LevenshteinDistanceMax(a, b string, max int) (int, bool)
- func LevenshteinDistanceMaxReuseSlice(a, b string, max int, d []int) (int, bool, []int)
- func RecordSearchCost(ctx context.Context, msg SearchIncrementalCostCallbackMsg, bytes uint64)
- type ArrayPositions
- type BytesSlice
- type Collector
- type DateRangeFacet
- type DateRangeFacets
- type DocumentMatch
- type DocumentMatchCollection
- type DocumentMatchHandler
- type DocumentMatchPool
- type DocumentMatchPoolTooSmall
- type Explanation
- type FacetBuilder
- type FacetResult
- type FacetResults
- type FacetsBuilder
- func (fb *FacetsBuilder) Add(name string, facetBuilder FacetBuilder)
- func (fb *FacetsBuilder) EndDoc()
- func (fb *FacetsBuilder) RequiredFields() []string
- func (fb *FacetsBuilder) Results() FacetResults
- func (fb *FacetsBuilder) Size() int
- func (fb *FacetsBuilder) StartDoc()
- func (fb *FacetsBuilder) UpdateVisitor(field string, term []byte)
- type FieldFragmentMap
- type FieldTermLocation
- type FieldTermLocationMap
- type GeoBufferPoolCallbackFunc
- type Location
- type Locations
- type MakeDocumentMatchHandler
- type MakeDocumentMatchHandlerKeyType
- type MakeKNNDocumentMatchHandler
- type NumericRangeFacet
- type NumericRangeFacets
- type ScoreExplCorrectionCallbackFunc
- type SearchContext
- type SearchIOStatsCallbackFunc
- type SearchIncrementalCostCallbackFn
- type SearchIncrementalCostCallbackMsg
- type SearchQueryType
- type SearchSort
- type Searcher
- type SearcherEndCallbackFn
- type SearcherOptions
- type SearcherStartCallbackFn
- type SortDocID
- func (s *SortDocID) Copy() SearchSort
- func (s *SortDocID) Descending() bool
- func (s *SortDocID) MarshalJSON() ([]byte, error)
- func (s *SortDocID) RequiresDocID() bool
- func (s *SortDocID) RequiresFields() []string
- func (s *SortDocID) RequiresScoring() bool
- func (s *SortDocID) Reverse()
- func (s *SortDocID) UpdateVisitor(field string, term []byte)
- func (s *SortDocID) Value(i *DocumentMatch) string
- type SortField
- func (s *SortField) Copy() SearchSort
- func (s *SortField) Descending() bool
- func (s *SortField) MarshalJSON() ([]byte, error)
- func (s *SortField) RequiresDocID() bool
- func (s *SortField) RequiresFields() []string
- func (s *SortField) RequiresScoring() bool
- func (s *SortField) Reverse()
- func (s *SortField) UpdateVisitor(field string, term []byte)
- func (s *SortField) Value(i *DocumentMatch) string
- type SortFieldMissing
- type SortFieldMode
- type SortFieldType
- type SortGeoDistance
- func (s *SortGeoDistance) Copy() SearchSort
- func (s *SortGeoDistance) Descending() bool
- func (s *SortGeoDistance) MarshalJSON() ([]byte, error)
- func (s *SortGeoDistance) RequiresDocID() bool
- func (s *SortGeoDistance) RequiresFields() []string
- func (s *SortGeoDistance) RequiresScoring() bool
- func (s *SortGeoDistance) Reverse()
- func (s *SortGeoDistance) UpdateVisitor(field string, term []byte)
- func (s *SortGeoDistance) Value(i *DocumentMatch) string
- type SortOrder
- func (so SortOrder) CacheDescending() []bool
- func (so SortOrder) CacheIsScore() []bool
- func (so SortOrder) Compare(cachedScoring, cachedDesc []bool, i, j *DocumentMatch) int
- func (so SortOrder) Copy() SortOrder
- func (so SortOrder) RequiredFields() []string
- func (so SortOrder) RequiresDocID() bool
- func (so SortOrder) RequiresScore() bool
- func (so SortOrder) Reverse()
- func (so SortOrder) UpdateVisitor(field string, term []byte)
- func (so SortOrder) Value(doc *DocumentMatch)
- type SortScore
- func (s *SortScore) Copy() SearchSort
- func (s *SortScore) Descending() bool
- func (s *SortScore) MarshalJSON() ([]byte, error)
- func (s *SortScore) RequiresDocID() bool
- func (s *SortScore) RequiresFields() []string
- func (s *SortScore) RequiresScoring() bool
- func (s *SortScore) Reverse()
- func (s *SortScore) UpdateVisitor(field string, term []byte)
- func (s *SortScore) Value(i *DocumentMatch) string
- type TermFacet
- type TermFacets
- func (tf *TermFacets) Add(termFacets ...*TermFacet)
- func (tf *TermFacets) Len() int
- func (tf *TermFacets) Less(i, j int) bool
- func (tf *TermFacets) MarshalJSON() ([]byte, error)
- func (tf *TermFacets) Swap(i, j int)
- func (tf *TermFacets) Terms() []*TermFacet
- func (tf *TermFacets) TrimToTopN(n int)
- func (tf *TermFacets) UnmarshalJSON(b []byte) error
- type TermLocationMap
Constants ¶
const ( Term = SearchQueryType(1 << iota) Geo Numeric GenericCost )
const ( AddM = SearchIncrementalCostCallbackMsg(1 << iota) AbortM DoneM )
const FuzzyMatchPhraseKey = "_fuzzy_match_phrase_key"
const GeoBufferPoolCallbackKey = "_geo_buffer_pool_callback_key"
const IncludeScoreBreakdownKey = "_include_score_breakdown_key"
const KnnPreSearchDataKey = "_knn_pre_search_data_key"
const MaxGeoBufPoolSize = 24 * 1024
Assigning the size of the largest buffer in the pool to 24KB and the smallest buffer to 24 bytes. The pools are used to read a sequence of vertices which are always 24 bytes each.
const MinGeoBufPoolSize = 24
const PreSearchKey = "_presearch_key"
const QueryTypeKey = "_query_type_key"
const SearchIOStatsCallbackKey = "_search_io_stats_callback_key"
const SearchIncrementalCostKey = "_search_incremental_cost_key"
const SearcherEndCallbackKey = "_searcher_end_callback_key"
const SearcherStartCallbackKey = "_searcher_start_callback_key"
Variables ¶
var LowTerm = string([]byte{0x00})
var MakeDocumentMatchHandlerKey = MakeDocumentMatchHandlerKeyType(
"MakeDocumentMatchHandlerKey")
var MakeKNNDocumentMatchHandlerKey = MakeDocumentMatchHandlerKeyType(
"MakeKNNDocumentMatchHandlerKey")
Functions ¶
func LevenshteinDistance ¶
func LevenshteinDistanceMax ¶
LevenshteinDistanceMax same as LevenshteinDistance but attempts to bail early once we know the distance will be greater than max in which case the first return val will be the max and the second will be true, indicating max was exceeded
func RecordSearchCost ¶ added in v2.3.9
func RecordSearchCost(ctx context.Context, msg SearchIncrementalCostCallbackMsg, bytes uint64)
Types ¶
type ArrayPositions ¶
type ArrayPositions []uint64
func (ArrayPositions) Compare ¶
func (ap ArrayPositions) Compare(other ArrayPositions) int
func (ArrayPositions) Equals ¶
func (ap ArrayPositions) Equals(other ArrayPositions) bool
type BytesSlice ¶
type BytesSlice [][]byte
func (BytesSlice) Len ¶
func (p BytesSlice) Len() int
func (BytesSlice) Less ¶
func (p BytesSlice) Less(i, j int) bool
func (BytesSlice) Swap ¶
func (p BytesSlice) Swap(i, j int)
type Collector ¶
type Collector interface { Collect(ctx context.Context, searcher Searcher, reader index.IndexReader) error Results() DocumentMatchCollection Total() uint64 MaxScore() float64 Took() time.Duration SetFacetsBuilder(facetsBuilder *FacetsBuilder) FacetResults() FacetResults }
type DateRangeFacet ¶
type DateRangeFacet struct { Name string `json:"name"` Start *string `json:"start,omitempty"` End *string `json:"end,omitempty"` Count int `json:"count"` }
func (*DateRangeFacet) Same ¶
func (drf *DateRangeFacet) Same(other *DateRangeFacet) bool
type DateRangeFacets ¶
type DateRangeFacets []*DateRangeFacet
func (DateRangeFacets) Add ¶
func (drf DateRangeFacets) Add(dateRangeFacet *DateRangeFacet) DateRangeFacets
func (DateRangeFacets) Len ¶
func (drf DateRangeFacets) Len() int
func (DateRangeFacets) Less ¶
func (drf DateRangeFacets) Less(i, j int) bool
func (DateRangeFacets) Swap ¶
func (drf DateRangeFacets) Swap(i, j int)
type DocumentMatch ¶
type DocumentMatch struct { Index string `json:"index,omitempty"` ID string `json:"id"` IndexInternalID index.IndexInternalID `json:"-"` Score float64 `json:"score"` Expl *Explanation `json:"explanation,omitempty"` Locations FieldTermLocationMap `json:"locations,omitempty"` Fragments FieldFragmentMap `json:"fragments,omitempty"` Sort []string `json:"sort,omitempty"` // Fields contains the values for document fields listed in // SearchRequest.Fields. Text fields are returned as strings, numeric // fields as float64s and date fields as strings. Fields map[string]interface{} `json:"fields,omitempty"` // used to maintain natural index order HitNumber uint64 `json:"-"` // used to temporarily hold field term location information during // search processing in an efficient, recycle-friendly manner, to // be later incorporated into the Locations map when search // results are completed FieldTermLocations []FieldTermLocation `json:"-"` // used to indicate if this match is a partial match // in the case of a disjunction search // this means that the match is partial because // not all sub-queries matched // if false, all the sub-queries matched PartialMatch bool `json:"partial_match,omitempty"` // used to indicate the sub-scores that combined to form the // final score for this document match. This is only populated // when the search request's query is a DisjunctionQuery // or a ConjunctionQuery. The map key is the index of the sub-query // in the DisjunctionQuery or ConjunctionQuery. The map value is the // sub-score for that sub-query. ScoreBreakdown map[int]float64 `json:"score_breakdown,omitempty"` // internal variable used in PreSearch phase of search in alias // to indicate the name of the index that this match came from. // used in knn search. // it is a stack of index names, the top of the stack is the name // of the index that this match came from // of the current alias view, used in alias of aliases scenario IndexNames []string `json:"index_names,omitempty"` }
func (*DocumentMatch) AddFieldValue ¶
func (dm *DocumentMatch) AddFieldValue(name string, value interface{})
func (*DocumentMatch) Complete ¶
func (dm *DocumentMatch) Complete(prealloc []Location) []Location
Complete performs final preparation & transformation of the DocumentMatch at the end of search processing, also allowing the caller to provide an optional preallocated locations slice
func (*DocumentMatch) Reset ¶
func (dm *DocumentMatch) Reset() *DocumentMatch
Reset allows an already allocated DocumentMatch to be reused
func (*DocumentMatch) Size ¶
func (dm *DocumentMatch) Size() int
func (*DocumentMatch) String ¶
func (dm *DocumentMatch) String() string
type DocumentMatchCollection ¶
type DocumentMatchCollection []*DocumentMatch
func (DocumentMatchCollection) Len ¶
func (c DocumentMatchCollection) Len() int
func (DocumentMatchCollection) Less ¶
func (c DocumentMatchCollection) Less(i, j int) bool
func (DocumentMatchCollection) Swap ¶
func (c DocumentMatchCollection) Swap(i, j int)
type DocumentMatchHandler ¶
type DocumentMatchHandler func(hit *DocumentMatch) error
DocumentMatchHandler is the type of document match callback bleve will invoke during the search. Eventually, bleve will indicate the completion of an ongoing search, by passing a nil value for the document match callback. The application should take a copy of the hit/documentMatch if it wish to own it or need prolonged access to it.
type DocumentMatchPool ¶
type DocumentMatchPool struct { TooSmall DocumentMatchPoolTooSmall // contains filtered or unexported fields }
DocumentMatchPool manages use/re-use of DocumentMatch instances it pre-allocates space from a single large block with the expected number of instances. It is not thread-safe as currently all aspects of search take place in a single goroutine.
func NewDocumentMatchPool ¶
func NewDocumentMatchPool(size, sortsize int) *DocumentMatchPool
NewDocumentMatchPool will build a DocumentMatchPool with memory pre-allocated to accommodate the requested number of DocumentMatch instances
func (*DocumentMatchPool) Get ¶
func (p *DocumentMatchPool) Get() *DocumentMatch
Get returns an available DocumentMatch from the pool if the pool was not allocated with sufficient size, an allocation will occur to satisfy this request. As a side-effect this will grow the size of the pool.
func (*DocumentMatchPool) Put ¶
func (p *DocumentMatchPool) Put(d *DocumentMatch)
Put returns a DocumentMatch to the pool
type DocumentMatchPoolTooSmall ¶
type DocumentMatchPoolTooSmall func(p *DocumentMatchPool) *DocumentMatch
DocumentMatchPoolTooSmall is a callback function that can be executed when the DocumentMatchPool does not have sufficient capacity By default we just perform just-in-time allocation, but you could log a message, or panic, etc.
type Explanation ¶
type Explanation struct { Value float64 `json:"value"` Message string `json:"message"` Children []*Explanation `json:"children,omitempty"` }
func (*Explanation) Size ¶
func (expl *Explanation) Size() int
func (*Explanation) String ¶
func (expl *Explanation) String() string
type FacetBuilder ¶
type FacetBuilder interface { StartDoc() UpdateVisitor(term []byte) EndDoc() Result() *FacetResult Field() string Size() int }
type FacetResult ¶
type FacetResult struct { Field string `json:"field"` Total int `json:"total"` Missing int `json:"missing"` Other int `json:"other"` Terms *TermFacets `json:"terms,omitempty"` NumericRanges NumericRangeFacets `json:"numeric_ranges,omitempty"` DateRanges DateRangeFacets `json:"date_ranges,omitempty"` }
func (*FacetResult) Fixup ¶
func (fr *FacetResult) Fixup(size int)
func (*FacetResult) Merge ¶
func (fr *FacetResult) Merge(other *FacetResult)
func (*FacetResult) Size ¶
func (fr *FacetResult) Size() int
type FacetResults ¶
type FacetResults map[string]*FacetResult
func (FacetResults) Fixup ¶
func (fr FacetResults) Fixup(name string, size int)
func (FacetResults) Merge ¶
func (fr FacetResults) Merge(other FacetResults)
type FacetsBuilder ¶
type FacetsBuilder struct {
// contains filtered or unexported fields
}
func NewFacetsBuilder ¶
func NewFacetsBuilder(indexReader index.IndexReader) *FacetsBuilder
func (*FacetsBuilder) Add ¶
func (fb *FacetsBuilder) Add(name string, facetBuilder FacetBuilder)
func (*FacetsBuilder) EndDoc ¶
func (fb *FacetsBuilder) EndDoc()
func (*FacetsBuilder) RequiredFields ¶
func (fb *FacetsBuilder) RequiredFields() []string
func (*FacetsBuilder) Results ¶
func (fb *FacetsBuilder) Results() FacetResults
func (*FacetsBuilder) Size ¶
func (fb *FacetsBuilder) Size() int
func (*FacetsBuilder) StartDoc ¶
func (fb *FacetsBuilder) StartDoc()
func (*FacetsBuilder) UpdateVisitor ¶
func (fb *FacetsBuilder) UpdateVisitor(field string, term []byte)
type FieldFragmentMap ¶
type FieldTermLocation ¶
func MergeFieldTermLocations ¶
func MergeFieldTermLocations(dest []FieldTermLocation, matches []*DocumentMatch) []FieldTermLocation
type FieldTermLocationMap ¶
type FieldTermLocationMap map[string]TermLocationMap
func MergeLocations ¶
func MergeLocations(locations []FieldTermLocationMap) FieldTermLocationMap
type GeoBufferPoolCallbackFunc ¶ added in v2.3.10
type GeoBufferPoolCallbackFunc func() *s2.GeoBufferPool
type Location ¶
type Location struct { // Pos is the position of the term within the field, starting at 1 Pos uint64 `json:"pos"` // Start and End are the byte offsets of the term in the field Start uint64 `json:"start"` End uint64 `json:"end"` // ArrayPositions contains the positions of the term within any elements. ArrayPositions ArrayPositions `json:"array_positions"` }
type MakeDocumentMatchHandler ¶
type MakeDocumentMatchHandler func(ctx *SearchContext) ( callback DocumentMatchHandler, loadID bool, err error)
MakeDocumentMatchHandler is an optional DocumentMatchHandler builder function which the applications can pass to bleve. These builder methods gives a DocumentMatchHandler function to bleve, which it will invoke on every document matches.
type MakeDocumentMatchHandlerKeyType ¶
type MakeDocumentMatchHandlerKeyType string
type MakeKNNDocumentMatchHandler ¶ added in v2.4.0
type MakeKNNDocumentMatchHandler func(ctx *SearchContext) ( callback DocumentMatchHandler, err error)
type NumericRangeFacet ¶
type NumericRangeFacet struct { Name string `json:"name"` Min *float64 `json:"min,omitempty"` Max *float64 `json:"max,omitempty"` Count int `json:"count"` }
func (*NumericRangeFacet) Same ¶
func (nrf *NumericRangeFacet) Same(other *NumericRangeFacet) bool
type NumericRangeFacets ¶
type NumericRangeFacets []*NumericRangeFacet
func (NumericRangeFacets) Add ¶
func (nrf NumericRangeFacets) Add(numericRangeFacet *NumericRangeFacet) NumericRangeFacets
func (NumericRangeFacets) Len ¶
func (nrf NumericRangeFacets) Len() int
func (NumericRangeFacets) Less ¶
func (nrf NumericRangeFacets) Less(i, j int) bool
func (NumericRangeFacets) Swap ¶
func (nrf NumericRangeFacets) Swap(i, j int)
type ScoreExplCorrectionCallbackFunc ¶ added in v2.4.0
type ScoreExplCorrectionCallbackFunc func(queryMatch *DocumentMatch, knnMatch *DocumentMatch) (float64, *Explanation)
type SearchContext ¶
type SearchContext struct { DocumentMatchPool *DocumentMatchPool Collector Collector IndexReader index.IndexReader }
SearchContext represents the context around a single search
func (*SearchContext) Size ¶
func (sc *SearchContext) Size() int
type SearchIOStatsCallbackFunc ¶ added in v2.3.6
type SearchIOStatsCallbackFunc func(uint64)
type SearchIncrementalCostCallbackFn ¶ added in v2.3.9
type SearchIncrementalCostCallbackFn func(SearchIncrementalCostCallbackMsg, SearchQueryType, uint64)
Implementation of SearchIncrementalCostCallbackFn should handle the following messages
- add: increment the cost of a search operation (which can be specific to a query type as well)
- abort: query was aborted due to a cancel of search's context (for eg), which can be handled differently as well
- done: indicates that a search was complete and the tracked cost can be handled safely by the implementation.
type SearchIncrementalCostCallbackMsg ¶ added in v2.3.9
type SearchIncrementalCostCallbackMsg uint
type SearchQueryType ¶ added in v2.3.9
type SearchQueryType uint
type SearchSort ¶
type SearchSort interface { UpdateVisitor(field string, term []byte) Value(a *DocumentMatch) string Descending() bool RequiresDocID() bool RequiresScoring() bool RequiresFields() []string Reverse() Copy() SearchSort }
func ParseSearchSortJSON ¶
func ParseSearchSortJSON(input json.RawMessage) (SearchSort, error)
func ParseSearchSortObj ¶
func ParseSearchSortObj(input map[string]interface{}) (SearchSort, error)
func ParseSearchSortString ¶
func ParseSearchSortString(input string) SearchSort
type Searcher ¶
type Searcher interface { Next(ctx *SearchContext) (*DocumentMatch, error) Advance(ctx *SearchContext, ID index.IndexInternalID) (*DocumentMatch, error) Close() error Weight() float64 SetQueryNorm(float64) Count() uint64 Min() int Size() int DocumentMatchPoolSize() int }
type SearcherEndCallbackFn ¶ added in v2.4.0
type SearcherOptions ¶
type SearcherStartCallbackFn ¶ added in v2.4.0
type SortDocID ¶
type SortDocID struct {
Desc bool
}
SortDocID will sort results by the document identifier
func (*SortDocID) Copy ¶
func (s *SortDocID) Copy() SearchSort
func (*SortDocID) Descending ¶
Descending determines the order of the sort
func (*SortDocID) MarshalJSON ¶
func (*SortDocID) RequiresDocID ¶
RequiresDocID says this SearchSort does require the DocID be loaded
func (*SortDocID) RequiresFields ¶
RequiresFields says this SearchStore does not require any stored fields
func (*SortDocID) RequiresScoring ¶
RequiresScoring says this SearchStore does not require scoring
func (*SortDocID) UpdateVisitor ¶
UpdateVisitor is a no-op for SortDocID as it's value is not dependent on any field terms
func (*SortDocID) Value ¶
func (s *SortDocID) Value(i *DocumentMatch) string
Value returns the sort value of the DocumentMatch
type SortField ¶
type SortField struct { Field string Desc bool Type SortFieldType Mode SortFieldMode Missing SortFieldMissing // contains filtered or unexported fields }
SortField will sort results by the value of a stored field
Field is the name of the field Descending reverse the sort order (default false) Type allows forcing of string/number/date behavior (default auto) Mode controls behavior for multi-values fields (default first) Missing controls behavior of missing values (default last)
func (*SortField) Copy ¶
func (s *SortField) Copy() SearchSort
func (*SortField) Descending ¶
Descending determines the order of the sort
func (*SortField) MarshalJSON ¶
func (*SortField) RequiresDocID ¶
RequiresDocID says this SearchSort does not require the DocID be loaded
func (*SortField) RequiresFields ¶
RequiresFields says this SearchStore requires the specified stored field
func (*SortField) RequiresScoring ¶
RequiresScoring says this SearchStore does not require scoring
func (*SortField) UpdateVisitor ¶
UpdateVisitor notifies this sort field that in this document this field has the specified term
func (*SortField) Value ¶
func (s *SortField) Value(i *DocumentMatch) string
Value returns the sort value of the DocumentMatch it also resets the state of this SortField for processing the next document
type SortFieldMissing ¶
type SortFieldMissing int
SortFieldMissing controls where documents missing a field value should be sorted
const ( // SortFieldMissingLast sorts documents missing a field at the end SortFieldMissingLast SortFieldMissing = iota // SortFieldMissingFirst sorts documents missing a field at the beginning SortFieldMissingFirst )
type SortFieldMode ¶
type SortFieldMode int
SortFieldMode describes the behavior if the field has multiple values
const ( // SortFieldDefault uses the first (or only) value, this is the default zero-value SortFieldDefault SortFieldMode = iota // FIXME name is confusing // SortFieldMin uses the minimum value SortFieldMin // SortFieldMax uses the maximum value SortFieldMax )
type SortFieldType ¶
type SortFieldType int
SortFieldType lets you control some internal sort behavior normally leaving this to the zero-value of SortFieldAuto is fine
const ( // SortFieldAuto applies heuristics attempt to automatically sort correctly SortFieldAuto SortFieldType = iota // SortFieldAsString forces sort as string (no prefix coded terms removed) SortFieldAsString // SortFieldAsNumber forces sort as string (prefix coded terms with shift > 0 removed) SortFieldAsNumber // SortFieldAsDate forces sort as string (prefix coded terms with shift > 0 removed) SortFieldAsDate )
type SortGeoDistance ¶
type SortGeoDistance struct { Field string Desc bool Unit string Lon float64 Lat float64 // contains filtered or unexported fields }
SortGeoDistance will sort results by the distance of an indexed geo point, from the provided location.
Field is the name of the field Descending reverse the sort order (default false)
func NewSortGeoDistance ¶
func NewSortGeoDistance(field, unit string, lon, lat float64, desc bool) ( *SortGeoDistance, error)
NewSortGeoDistance creates SearchSort instance for sorting documents by their distance from the specified point.
func (*SortGeoDistance) Copy ¶
func (s *SortGeoDistance) Copy() SearchSort
func (*SortGeoDistance) Descending ¶
func (s *SortGeoDistance) Descending() bool
Descending determines the order of the sort
func (*SortGeoDistance) MarshalJSON ¶
func (s *SortGeoDistance) MarshalJSON() ([]byte, error)
func (*SortGeoDistance) RequiresDocID ¶
func (s *SortGeoDistance) RequiresDocID() bool
RequiresDocID says this SearchSort does not require the DocID be loaded
func (*SortGeoDistance) RequiresFields ¶
func (s *SortGeoDistance) RequiresFields() []string
RequiresFields says this SearchStore requires the specified stored field
func (*SortGeoDistance) RequiresScoring ¶
func (s *SortGeoDistance) RequiresScoring() bool
RequiresScoring says this SearchStore does not require scoring
func (*SortGeoDistance) Reverse ¶
func (s *SortGeoDistance) Reverse()
func (*SortGeoDistance) UpdateVisitor ¶
func (s *SortGeoDistance) UpdateVisitor(field string, term []byte)
UpdateVisitor notifies this sort field that in this document this field has the specified term
func (*SortGeoDistance) Value ¶
func (s *SortGeoDistance) Value(i *DocumentMatch) string
Value returns the sort value of the DocumentMatch it also resets the state of this SortField for processing the next document
type SortOrder ¶
type SortOrder []SearchSort
func ParseSortOrderJSON ¶
func ParseSortOrderJSON(in []json.RawMessage) (SortOrder, error)
func ParseSortOrderStrings ¶
func (SortOrder) CacheDescending ¶
func (SortOrder) CacheIsScore ¶
func (SortOrder) Compare ¶
func (so SortOrder) Compare(cachedScoring, cachedDesc []bool, i, j *DocumentMatch) int
Compare will compare two document matches using the specified sort order if both are numbers, we avoid converting back to term
func (SortOrder) RequiredFields ¶
func (SortOrder) RequiresDocID ¶
func (SortOrder) RequiresScore ¶
func (SortOrder) UpdateVisitor ¶
func (SortOrder) Value ¶
func (so SortOrder) Value(doc *DocumentMatch)
type SortScore ¶
type SortScore struct {
Desc bool
}
SortScore will sort results by the document match score
func (*SortScore) Copy ¶
func (s *SortScore) Copy() SearchSort
func (*SortScore) Descending ¶
Descending determines the order of the sort
func (*SortScore) MarshalJSON ¶
func (*SortScore) RequiresDocID ¶
RequiresDocID says this SearchSort does not require the DocID be loaded
func (*SortScore) RequiresFields ¶
RequiresFields says this SearchStore does not require any store fields
func (*SortScore) RequiresScoring ¶
RequiresScoring says this SearchStore does require scoring
func (*SortScore) UpdateVisitor ¶
UpdateVisitor is a no-op for SortScore as it's value is not dependent on any field terms
func (*SortScore) Value ¶
func (s *SortScore) Value(i *DocumentMatch) string
Value returns the sort value of the DocumentMatch
type TermFacets ¶
type TermFacets struct {
// contains filtered or unexported fields
}
func (*TermFacets) Add ¶
func (tf *TermFacets) Add(termFacets ...*TermFacet)
func (*TermFacets) Len ¶
func (tf *TermFacets) Len() int
func (*TermFacets) Less ¶
func (tf *TermFacets) Less(i, j int) bool
func (*TermFacets) MarshalJSON ¶ added in v2.3.0
func (tf *TermFacets) MarshalJSON() ([]byte, error)
TermFacets used to be a type alias for []*TermFacet. To maintain backwards compatibility, we have to implement custom JSON marshalling.
func (*TermFacets) Swap ¶
func (tf *TermFacets) Swap(i, j int)
func (*TermFacets) Terms ¶ added in v2.3.0
func (tf *TermFacets) Terms() []*TermFacet
func (*TermFacets) TrimToTopN ¶ added in v2.3.0
func (tf *TermFacets) TrimToTopN(n int)
func (*TermFacets) UnmarshalJSON ¶ added in v2.3.0
func (tf *TermFacets) UnmarshalJSON(b []byte) error
type TermLocationMap ¶
func MergeTermLocationMaps ¶
func MergeTermLocationMaps(rv, other TermLocationMap) TermLocationMap
func (TermLocationMap) AddLocation ¶
func (t TermLocationMap) AddLocation(term string, location *Location)