Documentation ¶
Index ¶
- func RemoveNumericPaddedTerms(sourceValues [][]byte) [][]byte
- type Aggregation
- type Aggregations
- type Bucket
- func (b *Bucket) Aggregation(name string) Calculator
- func (b *Bucket) Aggregations() map[string]Calculator
- func (b *Bucket) Buckets(name string) []*Bucket
- func (b *Bucket) Consume(d *DocumentMatch)
- func (b *Bucket) Count() uint64
- func (b *Bucket) Duration() time.Duration
- func (b *Bucket) Finish()
- func (b *Bucket) Merge(other *Bucket)
- func (b *Bucket) Metric(name string) float64
- func (b *Bucket) Name() string
- type BucketCalculator
- type Calculator
- type Collectible
- type Collector
- type CompositeScorer
- type ConstantGeoPointSource
- type ConstantTextValueSource
- type Context
- type DateValueSource
- type DateValuesSource
- type DocumentMatch
- func (dm *DocumentMatch) Complete(prealloc []Location) []Location
- func (dm *DocumentMatch) DocValues(field string) [][]byte
- func (dm *DocumentMatch) LoadDocumentValues(ctx *Context, fields []string) error
- func (dm *DocumentMatch) Reset() *DocumentMatch
- func (dm *DocumentMatch) SetReader(r MatchReader)
- func (dm *DocumentMatch) Size() int
- func (dm *DocumentMatch) String() string
- func (dm *DocumentMatch) VisitStoredFields(visitor segment.StoredFieldVisitor) error
- type DocumentMatchCollection
- type DocumentMatchIterator
- type DocumentMatchPool
- type DocumentMatchPoolTooSmall
- type DocumentValueReadable
- type DurationCalculator
- type Explanation
- type FieldFragmentMap
- type FieldSource
- func (f FieldSource) Date(match *DocumentMatch) time.Time
- func (f FieldSource) Dates(match *DocumentMatch) []time.Time
- func (f FieldSource) Fields() []string
- func (f FieldSource) GeoPoint(match *DocumentMatch) *geo.Point
- func (f FieldSource) GeoPoints(match *DocumentMatch) []*geo.Point
- func (f FieldSource) Number(match *DocumentMatch) float64
- func (f FieldSource) Numbers(match *DocumentMatch) []float64
- func (f FieldSource) Value(match *DocumentMatch) []byte
- func (f FieldSource) Values(match *DocumentMatch) [][]byte
- type FieldTermLocation
- type FieldTermLocationMap
- type FilteringTextSource
- type GeoPointValueSource
- type GeoPointValuesSource
- type Location
- type Locations
- type MatchReader
- type MetricCalculator
- type MissingDateSource
- type MissingGeoPointSource
- type MissingNumericSource
- type MissingTextValueSource
- type NumericValueSource
- type NumericValuesSource
- type PointDistanceSource
- func (p PointDistanceSource) Fields() []string
- func (p PointDistanceSource) Number(match *DocumentMatch) float64
- func (p PointDistanceSource) Numbers(match *DocumentMatch) []float64
- func (p PointDistanceSource) Value(match *DocumentMatch) []byte
- func (p PointDistanceSource) Values(match *DocumentMatch) [][]byte
- type Reader
- type ScoreSource
- type Scorer
- type Searcher
- type SearcherOptions
- type Similarity
- type Sort
- type SortOrder
- type SortValue
- type StoredFieldVisitable
- type TermLocationMap
- type TextValueSource
- type TextValuesSource
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Aggregation ¶
type Aggregation interface { Fields() []string Calculator() Calculator }
type Aggregations ¶
type Aggregations map[string]Aggregation
func (Aggregations) Add ¶
func (a Aggregations) Add(name string, aggregation Aggregation)
func (Aggregations) Fields ¶
func (a Aggregations) Fields() []string
type Bucket ¶
type Bucket struct {
// contains filtered or unexported fields
}
func (*Bucket) Aggregation ¶
func (b *Bucket) Aggregation(name string) Calculator
func (*Bucket) Aggregations ¶
func (b *Bucket) Aggregations() map[string]Calculator
func (*Bucket) Consume ¶
func (b *Bucket) Consume(d *DocumentMatch)
type BucketCalculator ¶
type BucketCalculator interface { Calculator Buckets() []*Bucket }
type Calculator ¶
type Calculator interface { Consume(*DocumentMatch) Finish() Merge(Calculator) }
type Collectible ¶
type Collectible interface { Next(ctx *Context) (*DocumentMatch, error) DocumentMatchPoolSize() int Close() error }
type Collector ¶
type Collector interface { Collect(context.Context, Aggregations, Collectible) (DocumentMatchIterator, error) Size() int BackingSize() int }
type CompositeScorer ¶
type CompositeScorer interface { ScoreComposite(constituents []*DocumentMatch) float64 ExplainComposite(constituents []*DocumentMatch) *Explanation }
type ConstantGeoPointSource ¶
func NewConstantGeoPointSource ¶
func NewConstantGeoPointSource(p geo.Point) *ConstantGeoPointSource
func (*ConstantGeoPointSource) Fields ¶
func (p *ConstantGeoPointSource) Fields() []string
func (*ConstantGeoPointSource) GeoPoint ¶
func (p *ConstantGeoPointSource) GeoPoint(_ *DocumentMatch) *geo.Point
type ConstantTextValueSource ¶
type ConstantTextValueSource []byte
func (ConstantTextValueSource) Fields ¶
func (c ConstantTextValueSource) Fields() []string
func (ConstantTextValueSource) Value ¶
func (c ConstantTextValueSource) Value(_ *DocumentMatch) []byte
type Context ¶
type Context struct { DocumentMatchPool *DocumentMatchPool // contains filtered or unexported fields }
Context represents the context around a single search
func NewSearchContext ¶
func (*Context) DocValueReaderForReader ¶
func (sc *Context) DocValueReaderForReader(r DocumentValueReadable, fields []string) (segment.DocumentValueReader, error)
type DateValueSource ¶
type DateValueSource interface { Fields() []string Date(match *DocumentMatch) time.Time }
type DateValuesSource ¶
type DateValuesSource interface { Fields() []string Dates(match *DocumentMatch) []time.Time }
type DocumentMatch ¶
type DocumentMatch struct { Number uint64 Score float64 Explanation *Explanation Locations FieldTermLocationMap SortValue [][]byte // used to maintain natural index order HitNumber int // 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 // contains filtered or unexported fields }
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) DocValues ¶
func (dm *DocumentMatch) DocValues(field string) [][]byte
func (*DocumentMatch) LoadDocumentValues ¶
func (dm *DocumentMatch) LoadDocumentValues(ctx *Context, fields []string) error
func (*DocumentMatch) Reset ¶
func (dm *DocumentMatch) Reset() *DocumentMatch
Reset allows an already allocated DocumentMatch to be reused
func (*DocumentMatch) SetReader ¶
func (dm *DocumentMatch) SetReader(r MatchReader)
func (*DocumentMatch) Size ¶
func (dm *DocumentMatch) Size() int
func (*DocumentMatch) String ¶
func (dm *DocumentMatch) String() string
func (*DocumentMatch) VisitStoredFields ¶
func (dm *DocumentMatch) VisitStoredFields(visitor segment.StoredFieldVisitor) error
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 DocumentMatchIterator ¶
type DocumentMatchIterator interface { Next() (*DocumentMatch, error) Aggregations() *Bucket }
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 DocumentValueReadable ¶
type DocumentValueReadable interface { // DocumentValueReader provides a way to find all of the document // values stored in the specified fields. The returned // DocumentValueReader provides a means to visit specific document // numbers. DocumentValueReader(fields []string) (segment.DocumentValueReader, error) }
type DurationCalculator ¶
type DurationCalculator interface { Calculator Duration() time.Duration }
type Explanation ¶
type Explanation struct { Value float64 `json:"value"` Message string `json:"message"` Children []*Explanation `json:"children,omitempty"` }
func NewExplanation ¶
func NewExplanation(value float64, msg string, children ...*Explanation) *Explanation
func (*Explanation) Size ¶
func (e *Explanation) Size() int
func (*Explanation) String ¶
func (e *Explanation) String() string
type FieldFragmentMap ¶
type FieldSource ¶
type FieldSource string
func Field ¶
func Field(field string) FieldSource
func (FieldSource) Date ¶
func (f FieldSource) Date(match *DocumentMatch) time.Time
func (FieldSource) Dates ¶
func (f FieldSource) Dates(match *DocumentMatch) []time.Time
func (FieldSource) Fields ¶
func (f FieldSource) Fields() []string
func (FieldSource) GeoPoint ¶
func (f FieldSource) GeoPoint(match *DocumentMatch) *geo.Point
func (FieldSource) GeoPoints ¶
func (f FieldSource) GeoPoints(match *DocumentMatch) []*geo.Point
func (FieldSource) Number ¶
func (f FieldSource) Number(match *DocumentMatch) float64
func (FieldSource) Numbers ¶
func (f FieldSource) Numbers(match *DocumentMatch) []float64
func (FieldSource) Value ¶
func (f FieldSource) Value(match *DocumentMatch) []byte
func (FieldSource) Values ¶
func (f FieldSource) Values(match *DocumentMatch) [][]byte
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 FilteringTextSource ¶
type FilteringTextSource struct {
// contains filtered or unexported fields
}
func FilterText ¶
func FilterText(source TextValuesSource, filter func([]byte) bool) *FilteringTextSource
func (*FilteringTextSource) Fields ¶
func (f *FilteringTextSource) Fields() []string
func (*FilteringTextSource) Values ¶
func (f *FilteringTextSource) Values(match *DocumentMatch) [][]byte
type GeoPointValueSource ¶
type GeoPointValueSource interface { Fields() []string GeoPoint(match *DocumentMatch) *geo.Point }
type GeoPointValuesSource ¶
type GeoPointValuesSource interface { Fields() []string GeoPoints(match *DocumentMatch) []*geo.Point }
type MatchReader ¶
type MatchReader interface { DocumentValueReadable StoredFieldVisitable }
type MetricCalculator ¶
type MetricCalculator interface { Calculator Value() float64 }
type MissingDateSource ¶
type MissingDateSource struct {
// contains filtered or unexported fields
}
func MissingDate ¶
func MissingDate(primary, replacement DateValuesSource) *MissingDateSource
func (*MissingDateSource) Fields ¶
func (f *MissingDateSource) Fields() []string
func (*MissingDateSource) Numbers ¶
func (f *MissingDateSource) Numbers(match *DocumentMatch) []time.Time
type MissingGeoPointSource ¶
type MissingGeoPointSource struct {
// contains filtered or unexported fields
}
func MissingGeoPoints ¶
func MissingGeoPoints(primary, replacement GeoPointValuesSource) *MissingGeoPointSource
func (*MissingGeoPointSource) Fields ¶
func (f *MissingGeoPointSource) Fields() []string
func (*MissingGeoPointSource) GeoPoints ¶
func (f *MissingGeoPointSource) GeoPoints(match *DocumentMatch) []*geo.Point
type MissingNumericSource ¶
type MissingNumericSource struct {
// contains filtered or unexported fields
}
func MissingNumeric ¶
func MissingNumeric(primary, replacement NumericValuesSource) *MissingNumericSource
func (*MissingNumericSource) Fields ¶
func (f *MissingNumericSource) Fields() []string
func (*MissingNumericSource) Numbers ¶
func (f *MissingNumericSource) Numbers(match *DocumentMatch) []float64
type MissingTextValueSource ¶
type MissingTextValueSource struct {
// contains filtered or unexported fields
}
func MissingTextValue ¶
func MissingTextValue(primary, replacement TextValueSource) *MissingTextValueSource
func (*MissingTextValueSource) Fields ¶
func (f *MissingTextValueSource) Fields() []string
func (*MissingTextValueSource) Value ¶
func (f *MissingTextValueSource) Value(match *DocumentMatch) []byte
type NumericValueSource ¶
type NumericValueSource interface { Fields() []string Number(match *DocumentMatch) float64 }
type NumericValuesSource ¶
type NumericValuesSource interface { Fields() []string Numbers(match *DocumentMatch) []float64 }
type PointDistanceSource ¶
type PointDistanceSource struct {
// contains filtered or unexported fields
}
func NewGeoPointDistanceSource ¶
func NewGeoPointDistanceSource(a, b GeoPointValueSource, unit geo.DistanceUnit) *PointDistanceSource
func (PointDistanceSource) Fields ¶
func (p PointDistanceSource) Fields() []string
func (PointDistanceSource) Number ¶
func (p PointDistanceSource) Number(match *DocumentMatch) float64
func (PointDistanceSource) Numbers ¶
func (p PointDistanceSource) Numbers(match *DocumentMatch) []float64
func (PointDistanceSource) Value ¶
func (p PointDistanceSource) Value(match *DocumentMatch) []byte
func (PointDistanceSource) Values ¶
func (p PointDistanceSource) Values(match *DocumentMatch) [][]byte
type Reader ¶
type Reader interface { DocumentValueReadable StoredFieldVisitable CollectionStats(field string) (segment.CollectionStats, error) // DictionaryLookup provides a way to quickly determine if a term is // in the dictionary for the specified field. DictionaryLookup(field string) (segment.DictionaryLookup, error) // DictionaryIterator provides a way to explore the terms used in the // specified field. You can optionally filter these terms // by the provided Automaton, or start/end terms. DictionaryIterator(field string, automaton segment.Automaton, start, end []byte) (segment.DictionaryIterator, error) // PostingsIterator provides a way to find information about all documents // that use the specified term in the specified field. PostingsIterator(term []byte, field string, includeFreq, includeNorm, includeTermVectors bool) (segment.PostingsIterator, error) // Close releases all resources associated with this Reader Close() error }
type ScoreSource ¶
type ScoreSource struct{}
func DocumentScore ¶
func DocumentScore() *ScoreSource
func (*ScoreSource) Fields ¶
func (n *ScoreSource) Fields() []string
func (*ScoreSource) Number ¶
func (n *ScoreSource) Number(d *DocumentMatch) float64
func (*ScoreSource) Numbers ¶
func (n *ScoreSource) Numbers(d *DocumentMatch) []float64
func (*ScoreSource) Value ¶
func (n *ScoreSource) Value(d *DocumentMatch) []byte
func (*ScoreSource) Values ¶
func (n *ScoreSource) Values(d *DocumentMatch) [][]byte
type SearcherOptions ¶
type Similarity ¶
type Sort ¶
type Sort struct {
// contains filtered or unexported fields
}
func ParseSearchSortString ¶
func SortBy ¶
func SortBy(source TextValueSource) *Sort
func (*Sort) MissingFirst ¶
func (*Sort) Value ¶
func (s *Sort) Value(match *DocumentMatch) []byte
type SortOrder ¶
type SortOrder []*Sort
func ParseSortOrderStrings ¶
func (SortOrder) Compare ¶
func (o SortOrder) Compare(i, j *DocumentMatch) int
func (SortOrder) Compute ¶
func (o SortOrder) Compute(match *DocumentMatch)
type StoredFieldVisitable ¶
type StoredFieldVisitable interface { // VisitStoredFields will call the visitor for each stored field // of the specified document number. VisitStoredFields(number uint64, visitor segment.StoredFieldVisitor) error }
type TermLocationMap ¶
func MergeTermLocationMaps ¶
func MergeTermLocationMaps(rv, other TermLocationMap) TermLocationMap
func (TermLocationMap) AddLocation ¶
func (t TermLocationMap) AddLocation(term string, location *Location)
type TextValueSource ¶
type TextValueSource interface { Fields() []string Value(match *DocumentMatch) []byte }
type TextValuesSource ¶
type TextValuesSource interface { Fields() []string Values(match *DocumentMatch) [][]byte }