Documentation
¶
Index ¶
- Constants
- Variables
- func AsDocIdSetIterator(twoPhaseIterator index.TwoPhaseIterator) types.DocIdSetIterator
- func FromTermsEnumMatchesIterator(context index.LeafReaderContext, doc int, query index.Query, field string, ...) (index.MatchesIterator, error)
- func GetMaxClauseCount() int
- func GetTermsEnum(r *automaton.CompiledAutomaton, terms index.Terms) (index.TermsEnum, error)
- func IntersectIterators(iterators []types.DocIdSetIterator) types.DocIdSetIterator
- func MatchesForField(field string, mis IOSupplier[index.MatchesIterator]) index.Matches
- func MatchesFromSubMatches(subMatches []index.Matches) (index.Matches, error)
- func MergeTopDocs(start, topN int, shardHits []index.TopDocs, setShardIndex bool) (index.TopDocs, error)
- func NewChildScorable(child index.Scorable, relationship string) index.ChildScorable
- func NewIndexSearcher(r index.IndexReader) (index.IndexSearcher, error)
- func UnwrapIterator(iterator types.DocIdSetIterator) index.TwoPhaseIterator
- type AutomatonQuery
- func (r *AutomatonQuery) CreateWeight(searcher index.IndexSearcher, scoreMode index.ScoreMode, boost float64) (index.Weight, error)
- func (r *AutomatonQuery) GetField() string
- func (r *AutomatonQuery) GetRewriteMethod() RewriteMethod
- func (r *AutomatonQuery) GetTermsEnum(terms index.Terms, atts *attribute.Source) (index.TermsEnum, error)
- func (r *AutomatonQuery) Rewrite(reader index.IndexReader) (index.Query, error)
- func (r *AutomatonQuery) SetRewriteMethod(method RewriteMethod)
- func (r *AutomatonQuery) String(field string) string
- func (r *AutomatonQuery) Visit(visitor index.QueryVisitor) error
- type BM25Scorer
- type BM25Similarity
- func (b *BM25Similarity) ComputeNorm(state *index.FieldInvertState) int64
- func (b *BM25Similarity) GetB() float64
- func (b *BM25Similarity) GetDiscountOverlaps() bool
- func (b *BM25Similarity) GetK1() float64
- func (b *BM25Similarity) IdfExplain(collectionStats types.CollectionStatistics, termStats types.TermStatistics) types.Explanation
- func (b *BM25Similarity) IdfExplainV1(collectionStats types.CollectionStatistics, termStats []types.TermStatistics) types.Explanation
- func (b *BM25Similarity) Scorer(boost float64, collectionStats types.CollectionStatistics, ...) index.SimScorer
- func (b *BM25Similarity) SetDiscountOverlaps(v bool)
- func (b *BM25Similarity) String() string
- type BaseBulkScorer
- type BaseFieldDoc
- func (s BaseFieldDoc) GetDoc() int
- func (f *BaseFieldDoc) GetFields() []any
- func (s BaseFieldDoc) GetScore() float64
- func (s BaseFieldDoc) GetShardIndex() int
- func (s BaseFieldDoc) SetDoc(doc int)
- func (f *BaseFieldDoc) SetFields(fields []any)
- func (s BaseFieldDoc) SetScore(score float64)
- func (s BaseFieldDoc) SetShardIndex(shardIndex int)
- type BaseScorable
- type BaseScorer
- type BaseSimpleCollector
- type BaseTopDocs
- type BaseTopScoreDocCollector
- type BaseWeight
- func (r *BaseWeight) BulkScorer(ctx index.LeafReaderContext) (index.BulkScorer, error)
- func (r *BaseWeight) GetQuery() index.Query
- func (r *BaseWeight) Matches(leafReaderContext index.LeafReaderContext, doc int) (index.Matches, error)
- func (r *BaseWeight) ScorerSupplier(ctx index.LeafReaderContext) (index.ScorerSupplier, error)
- type BitDocIdSet
- type BitSetConjunctionDISI
- func (b *BitSetConjunctionDISI) Advance(ctx context.Context, target int) (int, error)
- func (b *BitSetConjunctionDISI) Cost() int64
- func (b *BitSetConjunctionDISI) DocID() int
- func (b *BitSetConjunctionDISI) NextDoc(context.Context) (int, error)
- func (b *BitSetConjunctionDISI) SlowAdvance(ctx context.Context, target int) (int, error)
- type BlockMaxConjunctionScorer
- func (b *BlockMaxConjunctionScorer) DocID() int
- func (b *BlockMaxConjunctionScorer) GetChildren() ([]index.ChildScorable, error)
- func (b *BlockMaxConjunctionScorer) GetMaxScore(upTo int) (float64, error)
- func (b *BlockMaxConjunctionScorer) Iterator() types.DocIdSetIterator
- func (b *BlockMaxConjunctionScorer) Score() (float64, error)
- func (b *BlockMaxConjunctionScorer) SetMinCompetitiveScore(score float64) error
- func (b *BlockMaxConjunctionScorer) TwoPhaseIterator() index.TwoPhaseIterator
- type BlockMaxDISI
- type Boolean2ScorerSupplier
- type BooleanClause
- type BooleanQuery
- func (b *BooleanQuery) Clauses() []*BooleanClause
- func (b *BooleanQuery) CreateWeight(searcher index.IndexSearcher, scoreMode index.ScoreMode, boost float64) (index.Weight, error)
- func (b *BooleanQuery) GetClauses(occur index.Occur) []index.Query
- func (b *BooleanQuery) GetMinimumNumberShouldMatch() int
- func (b *BooleanQuery) Iterator() iter.Seq[*BooleanClause]
- func (b *BooleanQuery) Rewrite(reader index.IndexReader) (index.Query, error)
- func (b *BooleanQuery) String(field string) string
- func (b *BooleanQuery) Visit(visitor index.QueryVisitor) error
- type BooleanQueryBuilder
- func (b *BooleanQueryBuilder) Add(clause *BooleanClause) *BooleanQueryBuilder
- func (b *BooleanQueryBuilder) AddQuery(query index.Query, occur index.Occur) *BooleanQueryBuilder
- func (b *BooleanQueryBuilder) Build() (*BooleanQuery, error)
- func (b *BooleanQueryBuilder) SetMinimumNumberShouldMatch(min int) *BooleanQueryBuilder
- type BooleanWeight
- func (b *BooleanWeight) BulkScorer(context index.LeafReaderContext) (index.BulkScorer, error)
- func (b *BooleanWeight) Explain(ctx index.LeafReaderContext, doc int) (types.Explanation, error)
- func (b *BooleanWeight) ExtractTerms(terms *treeset.Set[index.Term]) error
- func (b *BooleanWeight) IsCacheable(ctx index.LeafReaderContext) bool
- func (b *BooleanWeight) Matches(context index.LeafReaderContext, doc int) (index.Matches, error)
- func (b *BooleanWeight) Scorer(ctx index.LeafReaderContext) (index.Scorer, error)
- func (b *BooleanWeight) ScorerSupplier(leafReaderContext index.LeafReaderContext) (index.ScorerSupplier, error)
- type BoostQuery
- func (b *BoostQuery) CreateWeight(searcher index.IndexSearcher, scoreMode index.ScoreMode, boost float64) (index.Weight, error)
- func (b *BoostQuery) GetBoost() float64
- func (b *BoostQuery) GetQuery() index.Query
- func (b *BoostQuery) Rewrite(reader index.IndexReader) (index.Query, error)
- func (b *BoostQuery) String(field string) string
- func (b *BoostQuery) Visit(visitor index.QueryVisitor) error
- type Buffer
- type BufferAdder
- type BulkAdder
- type BulkScorer
- type CollectorManager
- type ConjunctionDISI
- func (c *ConjunctionDISI) Advance(ctx context.Context, target int) (int, error)
- func (c *ConjunctionDISI) Cost() int64
- func (c *ConjunctionDISI) DocID() int
- func (c *ConjunctionDISI) NextDoc(context.Context) (int, error)
- func (c *ConjunctionDISI) SlowAdvance(ctx context.Context, target int) (int, error)
- type ConjunctionScorer
- type ConjunctionTwoPhaseIterator
- type ConstantScoreQuery
- func (c *ConstantScoreQuery) CreateWeight(searcher index.IndexSearcher, scoreMode index.ScoreMode, boost float64) (index.Weight, error)
- func (c *ConstantScoreQuery) GetQuery() index.Query
- func (c *ConstantScoreQuery) Rewrite(reader index.IndexReader) (index.Query, error)
- func (c *ConstantScoreQuery) String(field string) string
- func (c *ConstantScoreQuery) Visit(visitor index.QueryVisitor) (err error)
- type ConstantScoreScorer
- type ConstantScoreWeight
- type DefaultBulkScorer
- type DisiPriorityQueue
- type DisiWrapper
- type DisjunctionMatchesIterator
- func (d *DisjunctionMatchesIterator) EndOffset() (int, error)
- func (d *DisjunctionMatchesIterator) EndPosition() int
- func (d *DisjunctionMatchesIterator) GetQuery() index.Query
- func (d *DisjunctionMatchesIterator) GetSubMatches() (index.MatchesIterator, error)
- func (d *DisjunctionMatchesIterator) Next() (bool, error)
- func (d *DisjunctionMatchesIterator) StartOffset() (int, error)
- func (d *DisjunctionMatchesIterator) StartPosition() int
- type DisjunctionMaxQuery
- func (d *DisjunctionMaxQuery) CreateWeight(searcher index.IndexSearcher, scoreMode index.ScoreMode, boost float64) (index.Weight, error)
- func (d *DisjunctionMaxQuery) GetDisjuncts() []index.Query
- func (d *DisjunctionMaxQuery) Rewrite(reader index.IndexReader) (index.Query, error)
- func (d *DisjunctionMaxQuery) String(field string) string
- func (d *DisjunctionMaxQuery) Visit(visitor index.QueryVisitor) error
- type DisjunctionScorer
- type DisjunctionSumScorer
- type DocAndScore
- type DocIdSet
- type DocIdSetBuilder
- type DocValuesFieldExistsQuery
- func (d *DocValuesFieldExistsQuery) CreateWeight(searcher index.IndexSearcher, scoreMode index.ScoreMode, boost float64) (index.Weight, error)
- func (d *DocValuesFieldExistsQuery) Rewrite(reader index.IndexReader) (index.Query, error)
- func (d *DocValuesFieldExistsQuery) String(field string) string
- func (d *DocValuesFieldExistsQuery) Visit(visitor index.QueryVisitor) error
- type Entry
- type Executor
- type FieldDoc
- type FieldValueHitQueue
- type FieldValueHitQueueDefault
- type FilterLeafCollector
- type FilterScorer
- type FixedBitSetAdder
- type GlobalHitsThresholdChecker
- type HitsThresholdChecker
- type IOSupplier
- type ImpactsDISI
- func (d *ImpactsDISI) Advance(ctx context.Context, target int) (int, error)
- func (d *ImpactsDISI) Cost() int64
- func (d *ImpactsDISI) DocID() int
- func (d *ImpactsDISI) GetMaxScore(upTo int) (float64, error)
- func (d *ImpactsDISI) NextDoc(context.Context) (int, error)
- func (d *ImpactsDISI) SlowAdvance(ctx context.Context, target int) (int, error)
- type InPlaceMergeSorter
- type IndexSearcher
- func (r *IndexSearcher) CollectionStatistics(field string) (types.CollectionStatistics, error)
- func (r *IndexSearcher) Count(query index.Query) (int, error)
- func (r *IndexSearcher) CreateWeight(query index.Query, scoreMode index.ScoreMode, boost float64) (index.Weight, error)
- func (r *IndexSearcher) Doc(ctx context.Context, docID int) (*document.Document, error)
- func (r *IndexSearcher) DocLimitFields(ctx context.Context, docId int, fieldsToLoad []string) (*document.Document, error)
- func (r *IndexSearcher) DocWithVisitor(ctx context.Context, docId int, fieldVisitor document.StoredFieldVisitor) error
- func (r *IndexSearcher) GetIndexReader() index.IndexReader
- func (r *IndexSearcher) GetQueryCache() (index.QueryCache, error)
- func (r *IndexSearcher) GetQueryCachingPolicy() (index.QueryCachingPolicy, error)
- func (r *IndexSearcher) GetSimilarity() index.Similarity
- func (r *IndexSearcher) GetSlices() []index.LeafSlice
- func (r *IndexSearcher) GetTopReaderContext() index.IndexReaderContext
- func (r *IndexSearcher) Rewrite(query index.Query) (index.Query, error)
- func (r *IndexSearcher) Search(ctx context.Context, query index.Query, results index.Collector) error
- func (r *IndexSearcher) SearchAfter(ctx context.Context, after index.ScoreDoc, query index.Query, numHits int) (index.TopDocs, error)
- func (r *IndexSearcher) SearchByCollectorManager(ctx context.Context, query index.Query, collectorManager CollectorManager) (any, error)
- func (r *IndexSearcher) SearchCollector(ctx context.Context, query index.Query, collector index.Collector) error
- func (r *IndexSearcher) SearchLeaves(ctx context.Context, leaves []index.LeafReaderContext, weight index.Weight, ...) error
- func (r *IndexSearcher) SearchTopN(ctx context.Context, query index.Query, n int) (index.TopDocs, error)
- func (r *IndexSearcher) SetQueryCache(queryCache index.QueryCache)
- func (r *IndexSearcher) SetQueryCachingPolicy(queryCachingPolicy index.QueryCachingPolicy)
- func (r *IndexSearcher) SetSimilarity(similarity index.Similarity)
- func (r *IndexSearcher) Slices(leaves []index.LeafReaderContext) []index.LeafSlice
- func (r *IndexSearcher) TermStatistics(term index.Term, docFreq, totalTermFreq int) (types.TermStatistics, error)
- type IntArrayDocIdSet
- type IntArrayDocIdSetIterator
- func (r *IntArrayDocIdSetIterator) Advance(ctx context.Context, target int) (int, error)
- func (r *IntArrayDocIdSetIterator) Cost() int64
- func (r *IntArrayDocIdSetIterator) DocID() int
- func (r *IntArrayDocIdSetIterator) NextDoc(context.Context) (int, error)
- func (r *IntArrayDocIdSetIterator) SlowAdvance(ctx context.Context, target int) (int, error)
- type LeafCollectorAnon
- type LeafSimScorer
- type LocalHitsThresholdChecker
- type MatchAllDocsQuery
- func (m *MatchAllDocsQuery) CreateWeight(searcher index.IndexSearcher, scoreMode index.ScoreMode, boost float64) (index.Weight, error)
- func (m *MatchAllDocsQuery) Rewrite(reader index.IndexReader) (index.Query, error)
- func (m *MatchAllDocsQuery) String(field string) string
- func (m *MatchAllDocsQuery) Visit(visitor index.QueryVisitor) error
- type MatchNoDocsQuery
- func (m *MatchNoDocsQuery) CreateWeight(searcher index.IndexSearcher, scoreMode index.ScoreMode, boost float64) (index.Weight, error)
- func (m *MatchNoDocsQuery) Rewrite(reader index.IndexReader) (index.Query, error)
- func (m *MatchNoDocsQuery) String(field string) string
- func (m *MatchNoDocsQuery) Visit(visitor index.QueryVisitor) (err error)
- type MatchesAnon
- type MaxScoreAccumulator
- type MaxScoreCache
- type MaxScoreSumPropagator
- type MultiComparatorLeafCollector
- type MultiComparatorsFieldValueHitQueue
- type MultiLeafFieldComparator
- func (m *MultiLeafFieldComparator) CompareBottom(doc int) (int, error)
- func (m *MultiLeafFieldComparator) CompareTop(doc int) (int, error)
- func (m *MultiLeafFieldComparator) CompetitiveIterator() (types.DocIdSetIterator, error)
- func (m *MultiLeafFieldComparator) Copy(slot, doc int) error
- func (m *MultiLeafFieldComparator) SetBottom(slot int) error
- func (m *MultiLeafFieldComparator) SetHitsThresholdReached() error
- func (m *MultiLeafFieldComparator) SetScorer(scorer index.Scorable) error
- type MultiTermQuery
- type MultiTermQueryConstantScoreWrapper
- func (m *MultiTermQueryConstantScoreWrapper) CreateWeight(searcher index.IndexSearcher, scoreMode index.ScoreMode, boost float64) (index.Weight, error)
- func (m *MultiTermQueryConstantScoreWrapper) GetField() string
- func (m *MultiTermQueryConstantScoreWrapper) GetQuery() index.Query
- func (m *MultiTermQueryConstantScoreWrapper) Rewrite(reader index.IndexReader) (index.Query, error)
- func (m *MultiTermQueryConstantScoreWrapper) String(field string) string
- func (m *MultiTermQueryConstantScoreWrapper) Visit(visitor index.QueryVisitor) (err error)
- type MultiTermQueryPlus
- type NamedMatches
- type OneComparatorFieldValueHitQueue
- type OptionBM25Similarity
- type PagingFieldCollector
- type PagingTopScoreDocCollector
- func (p *PagingTopScoreDocCollector) GetLeafCollector(ctx context.Context, readerContext index.LeafReaderContext) (index.LeafCollector, error)
- func (p *PagingTopScoreDocCollector) NewTopDocs(results []index.ScoreDoc, howMany int) (index.TopDocs, error)
- func (p *PagingTopScoreDocCollector) ScoreMode() index.ScoreMode
- func (p *PagingTopScoreDocCollector) TopDocsSize() int
- type PointInSetQuery
- type PointRangeQuery
- func (p *PointRangeQuery) CreateWeight(searcher coreIndex.IndexSearcher, scoreMode coreIndex.ScoreMode, boost float64) (coreIndex.Weight, error)
- func (p *PointRangeQuery) IsPointQuery() bool
- func (p *PointRangeQuery) Rewrite(reader coreIndex.IndexReader) (coreIndex.Query, error)
- func (p *PointRangeQuery) String(field string) string
- func (p *PointRangeQuery) Visit(visitor coreIndex.QueryVisitor) (err error)
- type PrefixQuery
- type ReqExclBulkScorer
- type ReqExclScorer
- type ReqOptSumScorer
- func (r *ReqOptSumScorer) AdvanceShallow(target int) (int, error)
- func (r *ReqOptSumScorer) DocID() int
- func (r *ReqOptSumScorer) GetMaxScore(upTo int) (float64, error)
- func (r *ReqOptSumScorer) Iterator() types.DocIdSetIterator
- func (r *ReqOptSumScorer) Score() (float64, error)
- func (r *ReqOptSumScorer) SetMinCompetitiveScore(minScore float64) error
- func (r *ReqOptSumScorer) TwoPhaseIterator() index.TwoPhaseIterator
- type RewriteMethod
- type ScoreAndDoc
- type ScoreCost
- type ScoreMergeSortQueue
- type ScoreRange
- type ScorerLeafCollector
- type ShardRef
- type SimpleCollector
- type SimpleCollectorSPI
- type SimpleFieldCollector
- type SimpleTopScoreDocCollector
- type StartDISIWrapper
- func (s *StartDISIWrapper) Advance(ctx context.Context, target int) (int, error)
- func (s *StartDISIWrapper) Cost() int64
- func (s *StartDISIWrapper) DocID() int
- func (s *StartDISIWrapper) NextDoc(context.Context) (int, error)
- func (s *StartDISIWrapper) SlowAdvance(ctx context.Context, target int) (int, error)
- type Supplier
- type TermInSetQuery
- func (t *TermInSetQuery) CreateWeight(searcher index.IndexSearcher, scoreMode index.ScoreMode, boost float64) (index.Weight, error)
- func (t *TermInSetQuery) Rewrite(reader index.IndexReader) (index.Query, error)
- func (t *TermInSetQuery) String(field string) string
- func (t *TermInSetQuery) Visit(visitor index.QueryVisitor) error
- type TermMatchesIterator
- func (t *TermMatchesIterator) EndOffset() (int, error)
- func (t *TermMatchesIterator) EndPosition() int
- func (t *TermMatchesIterator) GetQuery() index.Query
- func (t *TermMatchesIterator) GetSubMatches() (index.MatchesIterator, error)
- func (t *TermMatchesIterator) Next() (bool, error)
- func (t *TermMatchesIterator) StartOffset() (int, error)
- func (t *TermMatchesIterator) StartPosition() int
- type TermQuery
- func (t *TermQuery) CreateWeight(searcher index.IndexSearcher, scoreMode index.ScoreMode, boost float64) (index.Weight, error)
- func (t *TermQuery) GetTerm() index.Term
- func (t *TermQuery) NewTermWeight(searcher index.IndexSearcher, scoreMode index.ScoreMode, boost float64, ...) (*TermWeight, error)
- func (t *TermQuery) Rewrite(reader index.IndexReader) (index.Query, error)
- func (t *TermQuery) SetStates(states *coreIndex.TermStates) *TermQuery
- func (t *TermQuery) String(field string) string
- func (t *TermQuery) Visit(visitor index.QueryVisitor) error
- type TermRangeQuery
- type TermScorer
- func (t *TermScorer) DocID() int
- func (t *TermScorer) Freq() (int, error)
- func (t *TermScorer) GetChildren() ([]index.ChildScorable, error)
- func (t *TermScorer) GetMaxScore(upTo int) (float64, error)
- func (t *TermScorer) GetWeight() index.Weight
- func (t *TermScorer) Iterator() types.DocIdSetIterator
- func (t *TermScorer) Score() (float64, error)
- func (t *TermScorer) SetMinCompetitiveScore(minScore float64) error
- func (t *TermScorer) SmoothingScore(docId int) (float64, error)
- func (t *TermScorer) TwoPhaseIterator() index.TwoPhaseIterator
- type TermWeight
- func (t *TermWeight) Explain(context index.LeafReaderContext, doc int) (types.Explanation, error)
- func (t *TermWeight) ExtractTerms(terms *treeset.Set[index.Term]) error
- func (t *TermWeight) GetQuery() index.Query
- func (t *TermWeight) IsCacheable(ctx index.LeafReaderContext) bool
- func (t *TermWeight) Scorer(ctx index.LeafReaderContext) (index.Scorer, error)
- type TimSort
- type TimSortBitSet
- type TimSortTwoPhase
- type TopDocsCollector
- type TopDocsCollectorDefault
- func (t *TopDocsCollectorDefault[T]) GetTotalHits() int
- func (t *TopDocsCollectorDefault[T]) NewTopDocs(results []index.ScoreDoc, howMany int) (index.TopDocs, error)
- func (t *TopDocsCollectorDefault[T]) PopulateResults(results []index.ScoreDoc, howMany int) error
- func (t *TopDocsCollectorDefault[T]) TopDocs() (index.TopDocs, error)
- func (t *TopDocsCollectorDefault[T]) TopDocsFrom(start int) (index.TopDocs, error)
- func (t *TopDocsCollectorDefault[T]) TopDocsRange(start, howMany int) (index.TopDocs, error)
- func (t *TopDocsCollectorDefault[T]) TopDocsSize() int
- type TopFieldCollector
- type TopFieldDocs
- type TopScoreDocCollector
- func NewPagingTopScoreDocCollector(hits int, after index.ScoreDoc, checker HitsThresholdChecker, ...) (TopScoreDocCollector, error)
- func NewSimpleTopScoreDocCollector(numHits int, hitsThresholdChecker HitsThresholdChecker, ...) (TopScoreDocCollector, error)
- func TopScoreDocCollectorCreate(numHits int, after index.ScoreDoc, hitsThresholdChecker HitsThresholdChecker, ...) (TopScoreDocCollector, error)
- type TotalHitCountCollector
- type TwoPhase
- type WANDScorer
- type WeightScorer
Constants ¶
const (
ADVANCE_COST = 10
)
const (
BOOLEAN_REWRITE_TERM_COUNT_THRESHOLD = 16
)
const ( // DEFAULT_INTERVAL // we use 2^10-1 to check the remainder with a bitwise operation DEFAULT_INTERVAL = 0x3ff )
const (
TOTAL_HITS_THRESHOLD = 1000
)
Variables ¶
var ( // COMPLETE // Produced scorers will allow visiting all matches and get their score. COMPLETE = index.NewScoreMode(true, true) // COMPLETE_NO_SCORES // Produced scorers will allow visiting all matches but scores won't be available. COMPLETE_NO_SCORES = index.NewScoreMode(true, false) // TOP_SCORES // Produced scorers will optionally allow skipping over non-competitive hits using the Scorer.SetMinCompetitiveScore(float) API. TOP_SCORES = index.NewScoreMode(false, true) // TOP_DOCS // ScoreMode for top field collectors that can provide their own iterators, to optionally allow to skip for non-competitive docs TOP_DOCS = index.NewScoreMode(false, false) // TOP_DOCS_WITH_SCORES // ScoreMode for top field collectors that can provide their own iterators, to optionally allow to skip for non-competitive docs. This mode is used when there is a secondary sort by _score. TOP_DOCS_WITH_SCORES = index.NewScoreMode(false, true) )
var EMPTY_TOPDOCS = &BaseTopDocs{ totalHits: index.NewTotalHits(0, index.EQUAL_TO), scoreDocs: make([]index.ScoreDoc, 0), }
var (
LENGTH_TABLE = [256]float64{}/* 256 elements not displayed */
)
var MATCH_WITH_NO_TERMS index.Matches
Functions ¶
func AsDocIdSetIterator ¶
func AsDocIdSetIterator(twoPhaseIterator index.TwoPhaseIterator) types.DocIdSetIterator
func FromTermsEnumMatchesIterator ¶
func FromTermsEnumMatchesIterator(context index.LeafReaderContext, doc int, query index.Query, field string, terms bytesref.BytesIterator) (index.MatchesIterator, error)
FromTermsEnumMatchesIterator Create a DisjunctionMatchesIterator over a list of terms extracted from a BytesRefIterator Only terms that have at least one match in the given document will be included
func GetMaxClauseCount ¶
func GetMaxClauseCount() int
GetMaxClauseCount Return the maximum number of clauses permitted, 1024 by default. Attempts to add more than the permitted number of clauses cause BooleanQuery.TooManyClauses to be thrown.
See Also: setMaxClauseCount(int)
func GetTermsEnum ¶
func IntersectIterators ¶
func IntersectIterators(iterators []types.DocIdSetIterator) types.DocIdSetIterator
IntersectIterators Create a conjunction over the provided Scorers. Note that the returned DocIdSetIterator might leverage two-phase iteration in which case it is possible to retrieve the TwoPhaseIterator using TwoPhaseIterator.unwrap.
func MatchesForField ¶
func MatchesForField(field string, mis IOSupplier[index.MatchesIterator]) index.Matches
MatchesForField Create a Matches for a single field
func MatchesFromSubMatches ¶
MatchesFromSubMatches Amalgamate a collection of Matches into a single object
func MergeTopDocs ¶
func NewChildScorable ¶
func NewChildScorable(child index.Scorable, relationship string) index.ChildScorable
func NewIndexSearcher ¶
func NewIndexSearcher(r index.IndexReader) (index.IndexSearcher, error)
func UnwrapIterator ¶
func UnwrapIterator(iterator types.DocIdSetIterator) index.TwoPhaseIterator
Types ¶
type AutomatonQuery ¶
type AutomatonQuery struct {
// contains filtered or unexported fields
}
AutomatonQuery A Query that will match terms against a finite-state machine.
This query will match documents that contain terms accepted by a given finite-state machine. The automaton can be constructed with the org.apache.lucene.util.automaton API. Alternatively, it can be created from a regular expression with RegexpQuery or from the standard Lucene wildcard syntax with WildcardQuery.
When the query is executed, it will create an equivalent DFA of the finite-state machine, and will enumerate the term dictionary in an intelligent way to reduce the number of comparisons. For example: the regular expression of [dl]og? will make approximately four comparisons: do, dog, lo, and log. lucene.experimental
func NewAutomatonQuery ¶
func (*AutomatonQuery) CreateWeight ¶
func (r *AutomatonQuery) CreateWeight(searcher index.IndexSearcher, scoreMode index.ScoreMode, boost float64) (index.Weight, error)
func (*AutomatonQuery) GetField ¶
func (r *AutomatonQuery) GetField() string
func (*AutomatonQuery) GetRewriteMethod ¶
func (r *AutomatonQuery) GetRewriteMethod() RewriteMethod
func (*AutomatonQuery) GetTermsEnum ¶
func (*AutomatonQuery) Rewrite ¶
func (r *AutomatonQuery) Rewrite(reader index.IndexReader) (index.Query, error)
func (*AutomatonQuery) SetRewriteMethod ¶
func (r *AutomatonQuery) SetRewriteMethod(method RewriteMethod)
func (*AutomatonQuery) String ¶
func (r *AutomatonQuery) String(field string) string
func (*AutomatonQuery) Visit ¶
func (r *AutomatonQuery) Visit(visitor index.QueryVisitor) error
type BM25Scorer ¶
type BM25Scorer struct { *coreIndex.BaseSimScorer // contains filtered or unexported fields }
func NewBM25Scorer ¶
func NewBM25Scorer(boost, k1, b float64, idf types.Explanation, avgDocLength float64, cache []float64) *BM25Scorer
type BM25Similarity ¶
type BM25Similarity struct {
// contains filtered or unexported fields
}
BM25Similarity BM25 Similarity. Introduced in Stephen E. Robertson, Steve Walker, Susan Jones, Micheline Hancock-Beaulieu, and Mike Gatford. Okapi at TREC-3. In Proceedings of the Third Text REtrieval Conference (TREC 1994). Gaithersburg, USA, November 1994.
func NewBM25Similarity ¶
func NewBM25Similarity(options ...OptionBM25Similarity) (*BM25Similarity, error)
NewBM25Similarity BM25 with these default values: * k1 = 1.2 * b = 0.75
func (*BM25Similarity) ComputeNorm ¶
func (b *BM25Similarity) ComputeNorm(state *index.FieldInvertState) int64
func (*BM25Similarity) GetB ¶
func (b *BM25Similarity) GetB() float64
func (*BM25Similarity) GetDiscountOverlaps ¶
func (b *BM25Similarity) GetDiscountOverlaps() bool
GetDiscountOverlaps Returns true if overlap tokens are discounted from the document's length. See Also: setDiscountOverlaps
func (*BM25Similarity) GetK1 ¶
func (b *BM25Similarity) GetK1() float64
func (*BM25Similarity) IdfExplain ¶
func (b *BM25Similarity) IdfExplain( collectionStats types.CollectionStatistics, termStats types.TermStatistics) types.Explanation
IdfExplain Computes a score factor for a simple term and returns an explanation for that score factor. The default implementation uses:
idf(docFreq, docCount);
Note that CollectionStatistics.docCount() is used instead of Reader#numDocs() because also TermStatistics.docFreq() is used, and when the latter is inaccurate, so is CollectionStatistics.docCount(), and in the same direction. In addition, CollectionStatistics.docCount() does not skew when fields are sparse. Params: collectionStats – collection-level statistics
termStats – term-level statistics for the term
Returns: an Explain object that includes both an idf score factor and an explanation for the term.
func (*BM25Similarity) IdfExplainV1 ¶
func (b *BM25Similarity) IdfExplainV1( collectionStats types.CollectionStatistics, termStats []types.TermStatistics) types.Explanation
IdfExplainV1 Computes a score factor for a phrase. The default implementation sums the idf factor for each term in the phrase. collectionStats: collection-level statistics termStats: term-level statistics for the terms in the phrase Returns: an Explain object that includes both an idf score factor for the phrase and an explanation for each term.
func (*BM25Similarity) Scorer ¶
func (b *BM25Similarity) Scorer(boost float64, collectionStats types.CollectionStatistics, termStats []types.TermStatistics) index.SimScorer
func (*BM25Similarity) SetDiscountOverlaps ¶
func (b *BM25Similarity) SetDiscountOverlaps(v bool)
SetDiscountOverlaps Sets whether overlap tokens (Tokens with 0 position increment) are ignored when computing norm. By default this is true, meaning overlap tokens do not count when computing norms.
func (*BM25Similarity) String ¶
func (b *BM25Similarity) String() string
type BaseBulkScorer ¶
type BaseBulkScorer struct { FnScoreRange func(collector index.LeafCollector, acceptDocs util.Bits, min, max int) (int, error) FnCost func() int64 }
func (*BaseBulkScorer) Cost ¶
func (b *BaseBulkScorer) Cost() int64
func (*BaseBulkScorer) Score ¶
func (b *BaseBulkScorer) Score(collector index.LeafCollector, acceptDocs util.Bits, minDoc, maxDoc int) (int, error)
type BaseFieldDoc ¶
type BaseFieldDoc struct {
// contains filtered or unexported fields
}
func NewFieldDoc ¶
func NewFieldDoc(doc int, score float64) *BaseFieldDoc
NewFieldDoc Expert: Creates one of these objects with empty sort information.
func NewFieldDocV1 ¶
func NewFieldDocV1(doc int, score float64, fields []any) *BaseFieldDoc
NewFieldDocV1 Expert: Creates one of these objects with the given sort information.
func NewFieldDocV2 ¶
func NewFieldDocV2(doc int, score float64, fields []any, shardIndex int) *BaseFieldDoc
NewFieldDocV2 Expert: Creates one of these objects with the given sort information.
func (*BaseFieldDoc) GetFields ¶
func (f *BaseFieldDoc) GetFields() []any
func (BaseFieldDoc) GetShardIndex ¶
func (s BaseFieldDoc) GetShardIndex() int
func (*BaseFieldDoc) SetFields ¶
func (f *BaseFieldDoc) SetFields(fields []any)
func (BaseFieldDoc) SetShardIndex ¶
func (s BaseFieldDoc) SetShardIndex(shardIndex int)
type BaseScorable ¶
type BaseScorable struct { }
func (*BaseScorable) GetChildren ¶
func (*BaseScorable) GetChildren() ([]index.ChildScorable, error)
func (*BaseScorable) SetMinCompetitiveScore ¶
func (*BaseScorable) SetMinCompetitiveScore(minScore float64) error
func (*BaseScorable) SmoothingScore ¶
func (*BaseScorable) SmoothingScore(docId int) (float64, error)
type BaseScorer ¶
type BaseScorer struct { *BaseScorable // contains filtered or unexported fields }
func NewScorer ¶
func NewScorer(weight index.Weight) *BaseScorer
func (*BaseScorer) AdvanceShallow ¶
func (s *BaseScorer) AdvanceShallow(target int) (int, error)
func (*BaseScorer) GetWeight ¶
func (s *BaseScorer) GetWeight() index.Weight
func (*BaseScorer) TwoPhaseIterator ¶
func (s *BaseScorer) TwoPhaseIterator() index.TwoPhaseIterator
type BaseSimpleCollector ¶
type BaseSimpleCollector struct { SimpleCollectorSPI // contains filtered or unexported fields }
func NewSimpleCollector ¶
func NewSimpleCollector(spi SimpleCollectorSPI) *BaseSimpleCollector
func (BaseSimpleCollector) CompetitiveIterator ¶
func (BaseSimpleCollector) CompetitiveIterator() (types.DocIdSetIterator, error)
func (*BaseSimpleCollector) GetLeafCollector ¶
func (s *BaseSimpleCollector) GetLeafCollector(ctx context.Context, readerContext index.LeafReaderContext) (index.LeafCollector, error)
type BaseTopDocs ¶
type BaseTopDocs struct {
// contains filtered or unexported fields
}
BaseTopDocs Represents hits returned by IndexSearcher.search(Query, int).
func NewTopDocs ¶
func NewTopDocs(totalHits *index.TotalHits, scoreDocs []index.ScoreDoc) *BaseTopDocs
NewTopDocs Constructs a TopDocs.
func (*BaseTopDocs) GetScoreDocs ¶
func (t *BaseTopDocs) GetScoreDocs() []index.ScoreDoc
func (*BaseTopDocs) GetTotalHits ¶
func (t *BaseTopDocs) GetTotalHits() *index.TotalHits
type BaseTopScoreDocCollector ¶
type BaseTopScoreDocCollector struct { *TopDocsCollectorDefault[index.ScoreDoc] // contains filtered or unexported fields }
type BaseWeight ¶
type BaseWeight struct {
// contains filtered or unexported fields
}
func NewBaseWeight ¶
func NewBaseWeight(parentQuery index.Query, scorer WeightScorer) *BaseWeight
func (*BaseWeight) BulkScorer ¶
func (r *BaseWeight) BulkScorer(ctx index.LeafReaderContext) (index.BulkScorer, error)
func (*BaseWeight) GetQuery ¶
func (r *BaseWeight) GetQuery() index.Query
func (*BaseWeight) Matches ¶
func (r *BaseWeight) Matches(leafReaderContext index.LeafReaderContext, doc int) (index.Matches, error)
func (*BaseWeight) ScorerSupplier ¶
func (r *BaseWeight) ScorerSupplier(ctx index.LeafReaderContext) (index.ScorerSupplier, error)
type BitDocIdSet ¶
type BitDocIdSet struct {
// contains filtered or unexported fields
}
func NewBitDocIdSet ¶
func NewBitDocIdSet(set *bitset.BitSet, cost int64) *BitDocIdSet
func (BitDocIdSet) Bits ¶
func (b BitDocIdSet) Bits() util.Bits
func (BitDocIdSet) Iterator ¶
func (b BitDocIdSet) Iterator() types.DocIdSetIterator
type BitSetConjunctionDISI ¶
type BitSetConjunctionDISI struct {
// contains filtered or unexported fields
}
func (*BitSetConjunctionDISI) Cost ¶
func (b *BitSetConjunctionDISI) Cost() int64
func (*BitSetConjunctionDISI) DocID ¶
func (b *BitSetConjunctionDISI) DocID() int
func (*BitSetConjunctionDISI) NextDoc ¶
func (b *BitSetConjunctionDISI) NextDoc(context.Context) (int, error)
func (*BitSetConjunctionDISI) SlowAdvance ¶
type BlockMaxConjunctionScorer ¶
type BlockMaxConjunctionScorer struct { *BaseScorer // contains filtered or unexported fields }
func (*BlockMaxConjunctionScorer) DocID ¶
func (b *BlockMaxConjunctionScorer) DocID() int
func (*BlockMaxConjunctionScorer) GetChildren ¶
func (b *BlockMaxConjunctionScorer) GetChildren() ([]index.ChildScorable, error)
func (*BlockMaxConjunctionScorer) GetMaxScore ¶
func (b *BlockMaxConjunctionScorer) GetMaxScore(upTo int) (float64, error)
func (*BlockMaxConjunctionScorer) Iterator ¶
func (b *BlockMaxConjunctionScorer) Iterator() types.DocIdSetIterator
func (*BlockMaxConjunctionScorer) Score ¶
func (b *BlockMaxConjunctionScorer) Score() (float64, error)
func (*BlockMaxConjunctionScorer) SetMinCompetitiveScore ¶
func (b *BlockMaxConjunctionScorer) SetMinCompetitiveScore(score float64) error
func (*BlockMaxConjunctionScorer) TwoPhaseIterator ¶
func (b *BlockMaxConjunctionScorer) TwoPhaseIterator() index.TwoPhaseIterator
type BlockMaxDISI ¶
type BlockMaxDISI struct { }
func (*BlockMaxDISI) Cost ¶
func (b *BlockMaxDISI) Cost() int64
func (*BlockMaxDISI) DocID ¶
func (b *BlockMaxDISI) DocID() int
func (*BlockMaxDISI) SlowAdvance ¶
type Boolean2ScorerSupplier ¶
type Boolean2ScorerSupplier struct {
// contains filtered or unexported fields
}
func (*Boolean2ScorerSupplier) Cost ¶
func (b *Boolean2ScorerSupplier) Cost() int64
type BooleanClause ¶
type BooleanClause struct {
// contains filtered or unexported fields
}
BooleanClause A clause in a BooleanQuery.
func NewBooleanClause ¶
func NewBooleanClause(query index.Query, occur index.Occur) *BooleanClause
func (*BooleanClause) GetOccur ¶
func (b *BooleanClause) GetOccur() index.Occur
func (*BooleanClause) GetQuery ¶
func (b *BooleanClause) GetQuery() index.Query
func (*BooleanClause) IsProhibited ¶
func (b *BooleanClause) IsProhibited() bool
func (*BooleanClause) IsRequired ¶
func (b *BooleanClause) IsRequired() bool
func (*BooleanClause) IsScoring ¶
func (b *BooleanClause) IsScoring() bool
func (*BooleanClause) String ¶
func (b *BooleanClause) String() string
type BooleanQuery ¶
type BooleanQuery struct {
// contains filtered or unexported fields
}
BooleanQuery A Query that matches documents matching boolean combinations of other queries, e.g. TermQuerys, PhraseQuerys or other BooleanQuerys.
func (*BooleanQuery) Clauses ¶
func (b *BooleanQuery) Clauses() []*BooleanClause
Clauses Return a list of the clauses of this BooleanQuery.
func (*BooleanQuery) CreateWeight ¶
func (b *BooleanQuery) CreateWeight(searcher index.IndexSearcher, scoreMode index.ScoreMode, boost float64) (index.Weight, error)
func (*BooleanQuery) GetClauses ¶
func (b *BooleanQuery) GetClauses(occur index.Occur) []index.Query
GetClauses Return the collection of queries for the given BooleanClause.Occur.
func (*BooleanQuery) GetMinimumNumberShouldMatch ¶
func (b *BooleanQuery) GetMinimumNumberShouldMatch() int
GetMinimumNumberShouldMatch Gets the minimum number of the optional BooleanClauses which must be satisfied.
func (*BooleanQuery) Iterator ¶
func (b *BooleanQuery) Iterator() iter.Seq[*BooleanClause]
func (*BooleanQuery) Rewrite ¶
func (b *BooleanQuery) Rewrite(reader index.IndexReader) (index.Query, error)
func (*BooleanQuery) String ¶
func (b *BooleanQuery) String(field string) string
func (*BooleanQuery) Visit ¶
func (b *BooleanQuery) Visit(visitor index.QueryVisitor) error
type BooleanQueryBuilder ¶
type BooleanQueryBuilder struct {
// contains filtered or unexported fields
}
BooleanQueryBuilder A builder for boolean queries.
func NewBooleanQueryBuilder ¶
func NewBooleanQueryBuilder() *BooleanQueryBuilder
func (*BooleanQueryBuilder) Add ¶
func (b *BooleanQueryBuilder) Add(clause *BooleanClause) *BooleanQueryBuilder
Add a new clause to this BooleanQuery.Builder. Note that the order in which clauses are added does not have any impact on matching documents or query performance. Throws: BooleanQuery.TooManyClauses – if the new number of clauses exceeds the maximum clause number
func (*BooleanQueryBuilder) AddQuery ¶
func (b *BooleanQueryBuilder) AddQuery(query index.Query, occur index.Occur) *BooleanQueryBuilder
AddQuery a new clause to this BooleanQuery.Builder. Note that the order in which clauses are added does not have any impact on matching documents or query performance. Throws: BooleanQuery.TooManyClauses – if the new number of clauses exceeds the maximum clause number
func (*BooleanQueryBuilder) Build ¶
func (b *BooleanQueryBuilder) Build() (*BooleanQuery, error)
func (*BooleanQueryBuilder) SetMinimumNumberShouldMatch ¶
func (b *BooleanQueryBuilder) SetMinimumNumberShouldMatch(min int) *BooleanQueryBuilder
SetMinimumNumberShouldMatch Specifies a minimum number of the optional BooleanClauses which must be satisfied. By default no optional clauses are necessary for a match (unless there are no required clauses). If this method is used, then the specified number of clauses is required. Use of this method is totally independent of specifying that any specific clauses are required (or prohibited). This number will only be compared against the number of matching optional clauses. Params: min – the number of optional clauses that must match
type BooleanWeight ¶
type BooleanWeight struct { *BaseWeight // contains filtered or unexported fields }
BooleanWeight Expert: the Weight for BooleanQuery, used to normalize, score and explain these queries.
func NewBooleanWeight ¶
func NewBooleanWeight(query *BooleanQuery, searcher index.IndexSearcher, scoreMode index.ScoreMode, boost float64) (*BooleanWeight, error)
func (*BooleanWeight) BulkScorer ¶
func (b *BooleanWeight) BulkScorer(context index.LeafReaderContext) (index.BulkScorer, error)
func (*BooleanWeight) Explain ¶
func (b *BooleanWeight) Explain(ctx index.LeafReaderContext, doc int) (types.Explanation, error)
func (*BooleanWeight) ExtractTerms ¶
func (*BooleanWeight) IsCacheable ¶
func (b *BooleanWeight) IsCacheable(ctx index.LeafReaderContext) bool
func (*BooleanWeight) Matches ¶
func (b *BooleanWeight) Matches(context index.LeafReaderContext, doc int) (index.Matches, error)
func (*BooleanWeight) Scorer ¶
func (b *BooleanWeight) Scorer(ctx index.LeafReaderContext) (index.Scorer, error)
func (*BooleanWeight) ScorerSupplier ¶
func (b *BooleanWeight) ScorerSupplier(leafReaderContext index.LeafReaderContext) (index.ScorerSupplier, error)
type BoostQuery ¶
type BoostQuery struct {
// contains filtered or unexported fields
}
BoostQuery A Query wrapper that allows to give a boost to the wrapped query. Boost values that are less than one will give less importance to this query compared to other ones while values that are greater than one will give more importance to the scores returned by this query. More complex boosts can be applied by using FunctionScoreQuery in the lucene-queries module
func NewBoostQuery ¶
func NewBoostQuery(query index.Query, boost float64) (*BoostQuery, error)
func (*BoostQuery) CreateWeight ¶
func (b *BoostQuery) CreateWeight(searcher index.IndexSearcher, scoreMode index.ScoreMode, boost float64) (index.Weight, error)
func (*BoostQuery) GetBoost ¶
func (b *BoostQuery) GetBoost() float64
func (*BoostQuery) GetQuery ¶
func (b *BoostQuery) GetQuery() index.Query
func (*BoostQuery) Rewrite ¶
func (b *BoostQuery) Rewrite(reader index.IndexReader) (index.Query, error)
func (*BoostQuery) String ¶
func (b *BoostQuery) String(field string) string
func (*BoostQuery) Visit ¶
func (b *BoostQuery) Visit(visitor index.QueryVisitor) error
type Buffer ¶
type Buffer struct {
// contains filtered or unexported fields
}
func NewBufferBySize ¶
type BufferAdder ¶
type BufferAdder struct {
// contains filtered or unexported fields
}
func NewBufferAdder ¶
func NewBufferAdder(buffer *Buffer) *BufferAdder
func (*BufferAdder) Add ¶
func (b *BufferAdder) Add(doc int)
type BulkAdder ¶
type BulkAdder interface {
Add(doc int)
}
BulkAdder Utility class to efficiently add many docs in one go. See Also: grow
type BulkScorer ¶ added in v0.0.2
type BulkScorer interface {
GetScorer() (ScoreRange, ScoreCost)
}
type CollectorManager ¶
type CollectorManager interface { NewCollector() (index.Collector, error) Reduce(collectors []index.Collector) (any, error) }
CollectorManager A manager of collectors. This class is useful to parallelize execution of search requests and has two main methods:
- NewCollector() which must return a NEW collector which will be used to collect a certain set of leaves.
- Reduce(Collection) which will be used to reduce the results of individual collections into a meaningful result. This method is only called after all leaves have been fully collected.
See Also: IndexSearcher.search(Query, CollectorManager) lucene.experimental
type ConjunctionDISI ¶
type ConjunctionDISI struct {
// contains filtered or unexported fields
}
ConjunctionDISI A conjunction of DocIdSetIterators. Requires that all of its sub-iterators must be on the same document all the time. This iterates over the doc ids that are present in each given DocIdSetIterator. Public only for use in org.apache.lucene.search.spans. lucene.internal
func (*ConjunctionDISI) Cost ¶
func (c *ConjunctionDISI) Cost() int64
func (*ConjunctionDISI) DocID ¶
func (c *ConjunctionDISI) DocID() int
func (*ConjunctionDISI) SlowAdvance ¶
type ConjunctionScorer ¶
type ConjunctionScorer struct { *BaseScorer // contains filtered or unexported fields }
ConjunctionScorer Create a new ConjunctionScorer, note that scorers must be a subset of required.
func NewConjunctionScorer ¶
func (*ConjunctionScorer) DocID ¶
func (c *ConjunctionScorer) DocID() int
func (*ConjunctionScorer) GetMaxScore ¶
func (c *ConjunctionScorer) GetMaxScore(upTo int) (float64, error)
func (*ConjunctionScorer) Iterator ¶
func (c *ConjunctionScorer) Iterator() types.DocIdSetIterator
func (*ConjunctionScorer) Score ¶
func (c *ConjunctionScorer) Score() (float64, error)
func (*ConjunctionScorer) TwoPhaseIterator ¶
func (c *ConjunctionScorer) TwoPhaseIterator() index.TwoPhaseIterator
type ConjunctionTwoPhaseIterator ¶
type ConjunctionTwoPhaseIterator struct {
// contains filtered or unexported fields
}
func (*ConjunctionTwoPhaseIterator) Approximation ¶
func (c *ConjunctionTwoPhaseIterator) Approximation() types.DocIdSetIterator
func (*ConjunctionTwoPhaseIterator) MatchCost ¶
func (c *ConjunctionTwoPhaseIterator) MatchCost() float64
func (*ConjunctionTwoPhaseIterator) Matches ¶
func (c *ConjunctionTwoPhaseIterator) Matches() (bool, error)
type ConstantScoreQuery ¶
type ConstantScoreQuery struct {
// contains filtered or unexported fields
}
ConstantScoreQuery A query that wraps another query and simply returns a constant score equal to 1 for every document that matches the query. It therefore simply strips of all scores and always returns 1.
func NewConstantScoreQuery ¶
func NewConstantScoreQuery(query index.Query) *ConstantScoreQuery
func (*ConstantScoreQuery) CreateWeight ¶
func (c *ConstantScoreQuery) CreateWeight(searcher index.IndexSearcher, scoreMode index.ScoreMode, boost float64) (index.Weight, error)
func (*ConstantScoreQuery) GetQuery ¶
func (c *ConstantScoreQuery) GetQuery() index.Query
func (*ConstantScoreQuery) Rewrite ¶
func (c *ConstantScoreQuery) Rewrite(reader index.IndexReader) (index.Query, error)
func (*ConstantScoreQuery) String ¶
func (c *ConstantScoreQuery) String(field string) string
func (*ConstantScoreQuery) Visit ¶
func (c *ConstantScoreQuery) Visit(visitor index.QueryVisitor) (err error)
type ConstantScoreScorer ¶
type ConstantScoreScorer struct { *BaseScorer // contains filtered or unexported fields }
func NewConstantScoreScorer ¶
func NewConstantScoreScorer(weight index.Weight, score float64, scoreMode index.ScoreMode, disi types.DocIdSetIterator) (*ConstantScoreScorer, error)
NewConstantScoreScorer Constructor based on a DocIdSetIterator which will be used to drive iteration. Two phase iteration will not be supported.
weight: the parent weight score: the score to return on each document scoreMode: the score mode disi: the iterator that defines matching documents
func NewConstantScoreScorerV1 ¶
func NewConstantScoreScorerV1(weight index.Weight, score float64, scoreMode index.ScoreMode, twoPhaseIterator index.TwoPhaseIterator) (*ConstantScoreScorer, error)
func (*ConstantScoreScorer) DocID ¶
func (c *ConstantScoreScorer) DocID() int
func (*ConstantScoreScorer) GetMaxScore ¶
func (c *ConstantScoreScorer) GetMaxScore(upTo int) (float64, error)
func (*ConstantScoreScorer) Iterator ¶
func (c *ConstantScoreScorer) Iterator() types.DocIdSetIterator
func (*ConstantScoreScorer) Score ¶
func (c *ConstantScoreScorer) Score() (float64, error)
type ConstantScoreWeight ¶
type ConstantScoreWeight struct { *BaseWeight // contains filtered or unexported fields }
func NewConstantScoreWeight ¶
func NewConstantScoreWeight(score float64, query index.Query, spi WeightScorer) *ConstantScoreWeight
func (*ConstantScoreWeight) Explain ¶
func (c *ConstantScoreWeight) Explain(ctx index.LeafReaderContext, doc int) (types.Explanation, error)
func (*ConstantScoreWeight) ExtractTerms ¶
func (*ConstantScoreWeight) Score ¶
func (c *ConstantScoreWeight) Score() float64
type DefaultBulkScorer ¶
type DefaultBulkScorer struct {
// contains filtered or unexported fields
}
func NewDefaultBulkScorer ¶
func NewDefaultBulkScorer(scorer index.Scorer) *DefaultBulkScorer
func (*DefaultBulkScorer) Cost ¶
func (d *DefaultBulkScorer) Cost() int64
func (*DefaultBulkScorer) Score ¶
func (d *DefaultBulkScorer) Score(collector index.LeafCollector, acceptDocs util.Bits, minDoc, maxDoc int) (int, error)
type DisiPriorityQueue ¶
type DisiPriorityQueue struct { }
DisiPriorityQueue A priority queue of DocIdSetIterators that orders by current doc ID. This specialization is needed over PriorityQueue because the pluggable comparison function makes the rebalancing quite slow. lucene.internal
type DisiWrapper ¶
type DisiWrapper struct {
// contains filtered or unexported fields
}
DisiWrapper Wrapper used in DisiPriorityQueue. lucene.internal
type DisjunctionMatchesIterator ¶
type DisjunctionMatchesIterator struct {
// contains filtered or unexported fields
}
func (*DisjunctionMatchesIterator) EndOffset ¶
func (d *DisjunctionMatchesIterator) EndOffset() (int, error)
func (*DisjunctionMatchesIterator) EndPosition ¶
func (d *DisjunctionMatchesIterator) EndPosition() int
func (*DisjunctionMatchesIterator) GetQuery ¶
func (d *DisjunctionMatchesIterator) GetQuery() index.Query
func (*DisjunctionMatchesIterator) GetSubMatches ¶
func (d *DisjunctionMatchesIterator) GetSubMatches() (index.MatchesIterator, error)
func (*DisjunctionMatchesIterator) Next ¶
func (d *DisjunctionMatchesIterator) Next() (bool, error)
func (*DisjunctionMatchesIterator) StartOffset ¶
func (d *DisjunctionMatchesIterator) StartOffset() (int, error)
func (*DisjunctionMatchesIterator) StartPosition ¶
func (d *DisjunctionMatchesIterator) StartPosition() int
type DisjunctionMaxQuery ¶
type DisjunctionMaxQuery struct { }
DisjunctionMaxQuery A query that generates the union of documents produced by its subqueries, and that scores each document with the maximum score for that document as produced by any subquery, plus a tie breaking increment for any additional matching subqueries. This is useful when searching for a word in multiple fields with different boost factors (so that the fields cannot be combined equivalently into a single search field). We want the primary score to be the one associated with the highest boost, not the sum of the field scores (as BooleanQuery would give). If the query is "albino elephant" this ensures that "albino" matching one field and "elephant" matching another gets a higher score than "albino" matching both fields. To get this result, use both BooleanQuery and DisjunctionMaxQuery: for each term a DisjunctionMaxQuery searches for it in each field, while the set of these DisjunctionMaxQuery's is combined into a BooleanQuery. The tie breaker capability allows results that include the same term in multiple fields to be judged better than results that include this term in only the best of those multiple fields, without confusing this with the better case of two different terms in the multiple fields.
func (*DisjunctionMaxQuery) CreateWeight ¶
func (d *DisjunctionMaxQuery) CreateWeight(searcher index.IndexSearcher, scoreMode index.ScoreMode, boost float64) (index.Weight, error)
func (*DisjunctionMaxQuery) GetDisjuncts ¶
func (d *DisjunctionMaxQuery) GetDisjuncts() []index.Query
func (*DisjunctionMaxQuery) Rewrite ¶
func (d *DisjunctionMaxQuery) Rewrite(reader index.IndexReader) (index.Query, error)
func (*DisjunctionMaxQuery) String ¶
func (d *DisjunctionMaxQuery) String(field string) string
func (*DisjunctionMaxQuery) Visit ¶
func (d *DisjunctionMaxQuery) Visit(visitor index.QueryVisitor) error
type DisjunctionScorer ¶
type DisjunctionScorer struct { *BaseScorer // contains filtered or unexported fields }
DisjunctionScorer Base class for Scorers that score disjunctions.
type DisjunctionSumScorer ¶
type DisjunctionSumScorer struct {
*DisjunctionScorer
}
DisjunctionSumScorer A Scorer for OR like queries, counterpart of ConjunctionScorer.
func (*DisjunctionSumScorer) DocID ¶
func (d *DisjunctionSumScorer) DocID() int
func (*DisjunctionSumScorer) GetMaxScore ¶
func (d *DisjunctionSumScorer) GetMaxScore(upTo int) (float64, error)
func (*DisjunctionSumScorer) Iterator ¶
func (d *DisjunctionSumScorer) Iterator() types.DocIdSetIterator
func (*DisjunctionSumScorer) Score ¶
func (d *DisjunctionSumScorer) Score() (float64, error)
type DocAndScore ¶
type DocAndScore struct {
// contains filtered or unexported fields
}
func NewDocAndScore ¶
func NewDocAndScore(docBase int, score float64) *DocAndScore
type DocIdSet ¶
type DocIdSet interface { // Iterator // Provides a DocIdSetIterator to access the set. This implementation can return null if there are no docs that match. Iterator() types.DocIdSetIterator // Bits // TODO: somehow this class should express the cost of // iteration vs the cost of random access Bits; for // expensive Filters (e.g. distance < 1 km) we should use // bits() after all other Query/Filters have matched, but // this is the opposite of what bits() is for now // (down-low filtering using e.g. FixedBitSet) // // Optionally provides a Bits interface for random access to matching documents. // Returns: null, if this DocIdSet does not support random access. In contrast to iterator(), // a return value of null does not imply that no documents match the filter! The default // implementation does not provide random access, so you only need to implement this method // if your DocIdSet can guarantee random access to every docid in O(1) time without external // disk access (as Bits interface cannot throw IOException). This is generally true for bit // sets like org.apache.lucene.util.FixedBitSet, which return itself if they are used as DocIdSet. Bits() util.Bits }
A DocIdSet contains a set of doc ids. Implementing classes must only implement iterator to provide access to the set.
func GetEmptyDocIdSet ¶
func GetEmptyDocIdSet() DocIdSet
type DocIdSetBuilder ¶
type DocIdSetBuilder struct {
// contains filtered or unexported fields
}
DocIdSetBuilder A builder of DocIdSets. At first it uses a sparse structure to gather documents, and then upgrades to a non-sparse bit set once enough hits match. To add documents, you first need to call grow in order to reserve space, and then call DocIdSetBuilder.BulkAdder.add(int) on the returned DocIdSetBuilder.BulkAdder. lucene.internal
func NewDocIdSetBuilder ¶
func NewDocIdSetBuilder(maxDoc int) *DocIdSetBuilder
NewDocIdSetBuilder Create a builder that can contain doc IDs between 0 and maxDoc.
func NewDocIdSetBuilderV1 ¶
func NewDocIdSetBuilderV1(maxDoc int, terms index.Terms) (*DocIdSetBuilder, error)
NewDocIdSetBuilderV1 Create a DocIdSetBuilder instance that is optimized for accumulating docs that match the given Terms.
func NewDocIdSetBuilderV2 ¶
func NewDocIdSetBuilderV2(maxDoc int, values types.PointValues, field string) *DocIdSetBuilder
NewDocIdSetBuilderV2 Create a DocIdSetBuilder instance that is optimized for accumulating docs that match the given PointValues.
func (*DocIdSetBuilder) Add ¶
func (d *DocIdSetBuilder) Add(ctx context.Context, iter types.DocIdSetIterator) error
Add the content of the provided DocIdSetIterator to this builder. NOTE: if you need to build a DocIdSet out of a single DocIdSetIterator, you should rather use RoaringDocIdSet.Builder.
func (*DocIdSetBuilder) Build ¶
func (d *DocIdSetBuilder) Build() DocIdSet
Build a DocIdSet from the accumulated doc IDs.
func (*DocIdSetBuilder) Grow ¶
func (d *DocIdSetBuilder) Grow(numDocs int) BulkAdder
Grow Reserve space and return a DocIdSetBuilder.BulkAdder object that can be used to add up to numDocs documents.
type DocValuesFieldExistsQuery ¶
type DocValuesFieldExistsQuery struct { }
DocValuesFieldExistsQuery A Query that matches documents that have a value for a given field as reported by doc values iterators.
func (*DocValuesFieldExistsQuery) CreateWeight ¶
func (d *DocValuesFieldExistsQuery) CreateWeight(searcher index.IndexSearcher, scoreMode index.ScoreMode, boost float64) (index.Weight, error)
func (*DocValuesFieldExistsQuery) Rewrite ¶
func (d *DocValuesFieldExistsQuery) Rewrite(reader index.IndexReader) (index.Query, error)
func (*DocValuesFieldExistsQuery) String ¶
func (d *DocValuesFieldExistsQuery) String(field string) string
func (*DocValuesFieldExistsQuery) Visit ¶
func (d *DocValuesFieldExistsQuery) Visit(visitor index.QueryVisitor) error
type Entry ¶
type Entry struct {
// contains filtered or unexported fields
}
func (Entry) GetShardIndex ¶
func (s Entry) GetShardIndex() int
func (Entry) SetShardIndex ¶
func (s Entry) SetShardIndex(shardIndex int)
type FieldDoc ¶
FieldDoc Expert: A ScoreDoc which also contains information about how to sort the referenced document. In addition to the document number and score, this object contains an array of values for the document from the field(s) used to sort. For example, if the sort criteria was to sort by fields "a", "b" then "c", the fields object array will have three elements, corresponding respectively to the term values for the document in fields "a", "b" and "c". The class of each element in the array will be either Integer, Float or String depending on the type of values in the terms of each field.
Created: Feb 11, 2004 1:23:38 PM Since: lucene 1.4 See Also: ScoreDoc, TopFieldDocs
type FieldValueHitQueue ¶
type FieldValueHitQueue[T index.ScoreDoc] interface { Add(element T) T Top() T Pop() (T, error) UpdateTop() T UpdateTopByNewTop(newTop T) T Size() int Clear() Remove(element T) bool Iterator() iter.Seq[T] GetReverseMul() []int GetComparators(ctx index.LeafReaderContext) ([]index.LeafFieldComparator, error) GetComparatorsList() []index.FieldComparator }
FieldValueHitQueue Expert: A hit queue for sorting by hits by terms in more than one field. Since: 2.9 See Also: IndexSearcher.search(Query, int, Sort) lucene.experimental
func CreateFieldValueHitQueue ¶
func CreateFieldValueHitQueue(fields []index.SortField, size int) FieldValueHitQueue[*Entry]
CreateFieldValueHitQueue Creates a hit queue sorted by the given list of fields. NOTE: The instances returned by this method pre-allocate a full array of length numHits. Params: fields – SortField array we are sorting by in priority order (highest priority first);
cannot be null or empty size – The number of hits to retain. Must be greater than zero.
type FieldValueHitQueueDefault ¶
type FieldValueHitQueueDefault[T any] struct { *structure.PriorityQueue[T] // contains filtered or unexported fields }
func (*FieldValueHitQueueDefault[T]) GetComparators ¶
func (f *FieldValueHitQueueDefault[T]) GetComparators(ctx index.LeafReaderContext) ([]index.LeafFieldComparator, error)
func (*FieldValueHitQueueDefault[T]) GetComparatorsList ¶
func (f *FieldValueHitQueueDefault[T]) GetComparatorsList() []index.FieldComparator
func (*FieldValueHitQueueDefault[T]) GetReverseMul ¶
func (f *FieldValueHitQueueDefault[T]) GetReverseMul() []int
type FilterLeafCollector ¶
type FilterLeafCollector struct {
// contains filtered or unexported fields
}
type FilterScorer ¶
type FilterScorer struct { *BaseScorer // contains filtered or unexported fields }
A FilterScorer contains another Scorer, which it uses as its basic source of data, possibly transforming the data along the way or providing additional functionality. The class FilterScorer itself simply implements all abstract methods of Scorer with versions that pass all requests to the contained scorer. Subclasses of FilterScorer may further override some of these methods and may also provide additional methods and fields.
func (*FilterScorer) DocID ¶
func (f *FilterScorer) DocID() int
func (*FilterScorer) Iterator ¶
func (f *FilterScorer) Iterator() types.DocIdSetIterator
func (*FilterScorer) Score ¶
func (f *FilterScorer) Score() (float64, error)
func (*FilterScorer) TwoPhaseIterator ¶
func (f *FilterScorer) TwoPhaseIterator() index.TwoPhaseIterator
type FixedBitSetAdder ¶
type FixedBitSetAdder struct {
// contains filtered or unexported fields
}
func NewFixedBitSetAdder ¶
func NewFixedBitSetAdder(bitSet *bitset.BitSet) *FixedBitSetAdder
func (*FixedBitSetAdder) Add ¶
func (f *FixedBitSetAdder) Add(doc int)
type GlobalHitsThresholdChecker ¶
type GlobalHitsThresholdChecker struct {
// contains filtered or unexported fields
}
GlobalHitsThresholdChecker Implementation of HitsThresholdChecker which allows global hit counting
func NewGlobalHitsThresholdChecker ¶
func NewGlobalHitsThresholdChecker(totalHitsThreshold int) (*GlobalHitsThresholdChecker, error)
func (*GlobalHitsThresholdChecker) GetHitsThreshold ¶
func (g *GlobalHitsThresholdChecker) GetHitsThreshold() int
func (*GlobalHitsThresholdChecker) IncrementHitCount ¶
func (g *GlobalHitsThresholdChecker) IncrementHitCount()
func (*GlobalHitsThresholdChecker) IsThresholdReached ¶
func (g *GlobalHitsThresholdChecker) IsThresholdReached() bool
func (*GlobalHitsThresholdChecker) ScoreMode ¶
func (g *GlobalHitsThresholdChecker) ScoreMode() index.ScoreMode
type HitsThresholdChecker ¶
type HitsThresholdChecker interface { IncrementHitCount() ScoreMode() index.ScoreMode GetHitsThreshold() int IsThresholdReached() bool }
HitsThresholdChecker Used for defining custom algorithms to allow searches to early terminate
func HitsThresholdCheckerCreate ¶
func HitsThresholdCheckerCreate(totalHitsThreshold int) (HitsThresholdChecker, error)
func HitsThresholdCheckerCreateShared ¶
func HitsThresholdCheckerCreateShared(totalHitsThreshold int) (HitsThresholdChecker, error)
HitsThresholdCheckerCreateShared Returns a threshold checker that is based on a shared counter
type IOSupplier ¶
type ImpactsDISI ¶
type ImpactsDISI struct {
// contains filtered or unexported fields
}
ImpactsDISI DocIdSetIterator that skips non-competitive docs thanks to the indexed impacts. Call SetMinCompetitiveScore(float) in order to give this iterator the ability to skip low-scoring documents.
func NewImpactsDISI ¶
func NewImpactsDISI(in types.DocIdSetIterator, impactsSource index.ImpactsSource, scorer index.SimScorer) *ImpactsDISI
func (*ImpactsDISI) Cost ¶
func (d *ImpactsDISI) Cost() int64
func (*ImpactsDISI) DocID ¶
func (d *ImpactsDISI) DocID() int
func (*ImpactsDISI) GetMaxScore ¶
func (d *ImpactsDISI) GetMaxScore(upTo int) (float64, error)
GetMaxScore Implement the contract of Scorer.GetMaxScore(int) based on the wrapped ImpactsEnum and Scorer. See Also: Scorer.GetMaxScore(int)
func (*ImpactsDISI) SlowAdvance ¶
type InPlaceMergeSorter ¶
type InPlaceMergeSorter struct {
// contains filtered or unexported fields
}
func (InPlaceMergeSorter) Len ¶
func (r InPlaceMergeSorter) Len() int
func (InPlaceMergeSorter) Less ¶
func (r InPlaceMergeSorter) Less(i, j int) bool
func (InPlaceMergeSorter) Swap ¶
func (r InPlaceMergeSorter) Swap(i, j int)
type IndexSearcher ¶
type IndexSearcher struct {
// contains filtered or unexported fields
}
IndexSearcher Implements search over a single Reader. Applications usually need only call the inherited search(Query, int) method. For performance reasons, if your index is unchanging, you should share a single IndexSearcher instance across multiple searches instead of creating a new one per-search. If your index has changed and you wish to see the changes reflected in searching, you should use DirectoryReader.openIfChanged(DirectoryReader) to obtain a new reader and then create a new IndexSearcher from that. Also, for low-latency turnaround it's best to use a near-real-time reader (DirectoryReader.open(IndexWriter)). Once you have a new Reader, it's relatively cheap to create a new IndexSearcher from it.
NOTE: The search and searchAfter methods are configured to only count top hits accurately up to 1,000 and may return a lower bound of the hit count if the hit count is greater than or equal to 1,000. On queries that match lots of documents, counting the number of hits may take much longer than computing the top hits so this trade-off allows to get some minimal information about the hit count without slowing down search too much. The TopDocs.scoreDocs array is always accurate however. If this behavior doesn't suit your needs, you should create collectors manually with either TopScoreDocCollector.create or TopFieldCollector.create and call search(Query, Collector).
NOTE: IndexSearcher instances are completely thread safe, meaning multiple threads can call any of its methods, concurrently. If your application requires external synchronization, you should not synchronize on the IndexSearcher instance; use your own (non-Lucene) objects instead.
func (*IndexSearcher) CollectionStatistics ¶
func (r *IndexSearcher) CollectionStatistics(field string) (types.CollectionStatistics, error)
CollectionStatistics Returns CollectionStatistics for a field, or null if the field does not exist (has no indexed terms) This can be overridden for example, to return a field's statistics across a distributed collection.
func (*IndexSearcher) CreateWeight ¶
func (*IndexSearcher) DocLimitFields ¶
func (*IndexSearcher) DocWithVisitor ¶
func (r *IndexSearcher) DocWithVisitor(ctx context.Context, docId int, fieldVisitor document.StoredFieldVisitor) error
func (*IndexSearcher) GetIndexReader ¶
func (r *IndexSearcher) GetIndexReader() index.IndexReader
func (*IndexSearcher) GetQueryCache ¶
func (r *IndexSearcher) GetQueryCache() (index.QueryCache, error)
func (*IndexSearcher) GetQueryCachingPolicy ¶
func (r *IndexSearcher) GetQueryCachingPolicy() (index.QueryCachingPolicy, error)
func (*IndexSearcher) GetSimilarity ¶
func (r *IndexSearcher) GetSimilarity() index.Similarity
GetSimilarity Expert: Get the Similarity to use to compute scores. This returns the Similarity that has been set through setSimilarity(Similarity) or the default Similarity if none has been set explicitly.
func (*IndexSearcher) GetSlices ¶
func (r *IndexSearcher) GetSlices() []index.LeafSlice
func (*IndexSearcher) GetTopReaderContext ¶
func (r *IndexSearcher) GetTopReaderContext() index.IndexReaderContext
func (*IndexSearcher) SearchAfter ¶
func (r *IndexSearcher) SearchAfter(ctx context.Context, after index.ScoreDoc, query index.Query, numHits int) (index.TopDocs, error)
SearchAfter Finds the top n hits for query where all results are after a previous result (after). By passing the bottom result from a previous page as after, this method can be used for efficient 'deep-paging' across potentially large result sets. Throws: BooleanQuery.TooManyClauses – If a query would exceed BooleanQuery.getMaxClauseCount() clauses.
func (*IndexSearcher) SearchByCollectorManager ¶
func (r *IndexSearcher) SearchByCollectorManager(ctx context.Context, query index.Query, collectorManager CollectorManager) (any, error)
SearchByCollectorManager Lower-level search API. Search all leaves using the given CollectorManager. In contrast to search(Query, Collector), this method will use the searcher's Executor in order to parallelize execution of the collection on the configured leafSlices. See Also: CollectorManager lucene.experimental
func (*IndexSearcher) SearchCollector ¶
func (*IndexSearcher) SearchLeaves ¶
func (r *IndexSearcher) SearchLeaves(ctx context.Context, leaves []index.LeafReaderContext, weight index.Weight, collector index.Collector) error
func (*IndexSearcher) SearchTopN ¶
func (*IndexSearcher) SetQueryCache ¶
func (r *IndexSearcher) SetQueryCache(queryCache index.QueryCache)
func (*IndexSearcher) SetQueryCachingPolicy ¶
func (r *IndexSearcher) SetQueryCachingPolicy(queryCachingPolicy index.QueryCachingPolicy)
func (*IndexSearcher) SetSimilarity ¶
func (r *IndexSearcher) SetSimilarity(similarity index.Similarity)
func (*IndexSearcher) Slices ¶
func (r *IndexSearcher) Slices(leaves []index.LeafReaderContext) []index.LeafSlice
func (*IndexSearcher) TermStatistics ¶
func (r *IndexSearcher) TermStatistics(term index.Term, docFreq, totalTermFreq int) (types.TermStatistics, error)
TermStatistics Returns TermStatistics for a term. This can be overridden for example, to return a term's statistics across a distributed collection. Params: docFreq – The document frequency of the term. It must be greater or equal to 1. totalTermFreq – The total term frequency. Returns: A TermStatistics (never null).
type IntArrayDocIdSet ¶
type IntArrayDocIdSet struct {
// contains filtered or unexported fields
}
func NewIntArrayDocIdSet ¶
func NewIntArrayDocIdSet(docs []int) *IntArrayDocIdSet
func (*IntArrayDocIdSet) Bits ¶
func (r *IntArrayDocIdSet) Bits() util.Bits
func (*IntArrayDocIdSet) Iterator ¶
func (r *IntArrayDocIdSet) Iterator() types.DocIdSetIterator
type IntArrayDocIdSetIterator ¶
type IntArrayDocIdSetIterator struct {
// contains filtered or unexported fields
}
func NewIntArrayDocIdSetIterator ¶
func NewIntArrayDocIdSetIterator(docs []int) *IntArrayDocIdSetIterator
func (*IntArrayDocIdSetIterator) Cost ¶
func (r *IntArrayDocIdSetIterator) Cost() int64
func (*IntArrayDocIdSetIterator) DocID ¶
func (r *IntArrayDocIdSetIterator) DocID() int
func (*IntArrayDocIdSetIterator) NextDoc ¶
func (r *IntArrayDocIdSetIterator) NextDoc(context.Context) (int, error)
func (*IntArrayDocIdSetIterator) SlowAdvance ¶
type LeafCollectorAnon ¶
type LeafCollectorAnon struct { FnSetScorer func(scorer index.Scorable) error FnCollect func(ctx context.Context, doc int) error FnCompetitiveIterator func() (types.DocIdSetIterator, error) }
func (*LeafCollectorAnon) Collect ¶
func (l *LeafCollectorAnon) Collect(ctx context.Context, doc int) error
func (*LeafCollectorAnon) CompetitiveIterator ¶
func (l *LeafCollectorAnon) CompetitiveIterator() (types.DocIdSetIterator, error)
type LeafSimScorer ¶
type LeafSimScorer struct {
// contains filtered or unexported fields
}
func NewLeafSimScorer ¶
func NewLeafSimScorer(scorer index.SimScorer, reader index.LeafReader, field string, needsScores bool) (*LeafSimScorer, error)
NewLeafSimScorer org.apache.lucene.search.similarities.Similarity.SimScorer on a specific LeafReader.
func (*LeafSimScorer) Explain ¶
func (r *LeafSimScorer) Explain(doc int, freqExp types.Explanation) (types.Explanation, error)
Explain the score for the provided document assuming the given term document frequency. This method must be called on non-decreasing sequences of doc ids. See Also: org.apache.lucene.search.similarities.Similarity.SimScorer.explain(Explanation, long)
func (*LeafSimScorer) GetSimScorer ¶
func (r *LeafSimScorer) GetSimScorer() index.SimScorer
type LocalHitsThresholdChecker ¶
type LocalHitsThresholdChecker struct {
// contains filtered or unexported fields
}
LocalHitsThresholdChecker Default implementation of HitsThresholdChecker to be used for single threaded execution
func NewLocalHitsThresholdChecker ¶
func NewLocalHitsThresholdChecker(totalHitsThreshold int) (*LocalHitsThresholdChecker, error)
func (*LocalHitsThresholdChecker) GetHitsThreshold ¶
func (l *LocalHitsThresholdChecker) GetHitsThreshold() int
func (*LocalHitsThresholdChecker) IncrementHitCount ¶
func (l *LocalHitsThresholdChecker) IncrementHitCount()
func (*LocalHitsThresholdChecker) IsThresholdReached ¶
func (l *LocalHitsThresholdChecker) IsThresholdReached() bool
func (*LocalHitsThresholdChecker) ScoreMode ¶
func (l *LocalHitsThresholdChecker) ScoreMode() index.ScoreMode
type MatchAllDocsQuery ¶
type MatchAllDocsQuery struct { }
func NewMatchAllDocsQuery ¶
func NewMatchAllDocsQuery() *MatchAllDocsQuery
func (*MatchAllDocsQuery) CreateWeight ¶
func (m *MatchAllDocsQuery) CreateWeight(searcher index.IndexSearcher, scoreMode index.ScoreMode, boost float64) (index.Weight, error)
func (*MatchAllDocsQuery) Rewrite ¶
func (m *MatchAllDocsQuery) Rewrite(reader index.IndexReader) (index.Query, error)
func (*MatchAllDocsQuery) String ¶
func (m *MatchAllDocsQuery) String(field string) string
func (*MatchAllDocsQuery) Visit ¶
func (m *MatchAllDocsQuery) Visit(visitor index.QueryVisitor) error
type MatchNoDocsQuery ¶
type MatchNoDocsQuery struct {
// contains filtered or unexported fields
}
MatchNoDocsQuery A query that matches no documents.
func NewMatchNoDocsQuery ¶
func NewMatchNoDocsQuery(reason string) *MatchNoDocsQuery
func (*MatchNoDocsQuery) CreateWeight ¶
func (m *MatchNoDocsQuery) CreateWeight(searcher index.IndexSearcher, scoreMode index.ScoreMode, boost float64) (index.Weight, error)
func (*MatchNoDocsQuery) Rewrite ¶
func (m *MatchNoDocsQuery) Rewrite(reader index.IndexReader) (index.Query, error)
func (*MatchNoDocsQuery) String ¶
func (m *MatchNoDocsQuery) String(field string) string
func (*MatchNoDocsQuery) Visit ¶
func (m *MatchNoDocsQuery) Visit(visitor index.QueryVisitor) (err error)
type MatchesAnon ¶
type MatchesAnon struct { FnStrings func() []string FnGetMatches func(field string) (index.MatchesIterator, error) FnGetSubMatches func() []index.Matches }
func (*MatchesAnon) GetMatches ¶
func (m *MatchesAnon) GetMatches(field string) (index.MatchesIterator, error)
func (*MatchesAnon) GetSubMatches ¶
func (m *MatchesAnon) GetSubMatches() []index.Matches
func (*MatchesAnon) Strings ¶
func (m *MatchesAnon) Strings() []string
type MaxScoreAccumulator ¶
type MaxScoreAccumulator struct {
// contains filtered or unexported fields
}
MaxScoreAccumulator Maintains the maximum score and its corresponding document id concurrently
func NewMaxScoreAccumulator ¶
func NewMaxScoreAccumulator() *MaxScoreAccumulator
func (*MaxScoreAccumulator) Accumulate ¶
func (m *MaxScoreAccumulator) Accumulate(docBase int, score float32) error
func (*MaxScoreAccumulator) Get ¶
func (m *MaxScoreAccumulator) Get() *DocAndScore
type MaxScoreCache ¶
type MaxScoreCache struct {
// contains filtered or unexported fields
}
MaxScoreCache Compute maximum scores based on Impacts and keep them in a cache in order not to run expensive similarity score computations multiple times on the same data.
func NewMaxScoreCache ¶
func NewMaxScoreCache(impactsSource index.ImpactsSource, scorer index.SimScorer) *MaxScoreCache
func (*MaxScoreCache) GetLevel ¶
func (c *MaxScoreCache) GetLevel(upTo int) (int, error)
GetLevel Return the first level that includes all doc IDs up to upTo, or -1 if there is no such level.
func (*MaxScoreCache) GetMaxScoreForLevel ¶
func (c *MaxScoreCache) GetMaxScoreForLevel(level int) (float64, error)
func (*MaxScoreCache) GetSkipUpTo ¶
func (c *MaxScoreCache) GetSkipUpTo(minScore float64) (int, error)
GetSkipUpTo Return the an inclusive upper bound of documents that all have a score that is less than minScore, or -1 if the current document may be competitive.
type MaxScoreSumPropagator ¶
type MaxScoreSumPropagator struct {
// contains filtered or unexported fields
}
MaxScoreSumPropagator Utility class to propagate scoring information in BooleanQuery, which compute the score as the sum of the scores of its matching clauses. This helps propagate information about the maximum produced score GPT3.5: 这段注释描述的是`MaxScoreSumPropagator`作为一个实用工具类的用途。它用于在布尔查询(BooleanQuery)中传播评分信息, 其中查询的得分是其匹配子查询得分的累加和。这有助于传播关于生成的最大得分的信息。
在布尔查询中,可能包含多个子查询(clauses),如"must"(必须匹配)子查询和"should"(可选匹配)子查询。 每个子查询都会计算出一个相关性得分,表示文档与该子查询的匹配程度。
`MaxScoreSumPropagator`的作用是将这些子查询的得分信息进行传播。它会遍历所有子查询的匹配文档, 对于每个文档,将其得分与之前的最大得分进行比较,并保留最大得分。这样,最终的文档得分就是所有子查询中的最大得分之和。
通过这种传播机制,`MaxScoreSumPropagator`能够确保布尔查询的文档得分是基于各个子查询中最相关的得分进行计算的。 这对于提高搜索结果的质量和排序准确性非常有帮助,因为它可以将最相关的子查询的得分信息传递给最终的文档得分。
总而言之,`MaxScoreSumPropagator`是一个用于在布尔查询中传播评分信息的实用工具类,用于确保最终文档得分是各个子查询中最相关得分的累加和。
func NewMaxScoreSumPropagator ¶
func NewMaxScoreSumPropagator(scorerList []index.Scorer) (*MaxScoreSumPropagator, error)
func (*MaxScoreSumPropagator) SetMinCompetitiveScore ¶
func (m *MaxScoreSumPropagator) SetMinCompetitiveScore(minScore float64) error
type MultiComparatorLeafCollector ¶
type MultiComparatorLeafCollector struct {
// contains filtered or unexported fields
}
func NewMultiComparatorLeafCollector ¶
func NewMultiComparatorLeafCollector(comparators []index.LeafFieldComparator, reverseMul []int) *MultiComparatorLeafCollector
type MultiComparatorsFieldValueHitQueue ¶
type MultiComparatorsFieldValueHitQueue struct { *FieldValueHitQueueDefault[*Entry] }
func NewMultiComparatorsFieldValueHitQueue ¶
func NewMultiComparatorsFieldValueHitQueue(fields []index.SortField, size int) *MultiComparatorsFieldValueHitQueue
func (*MultiComparatorsFieldValueHitQueue) Less ¶
func (m *MultiComparatorsFieldValueHitQueue) Less(hitA, hitB *Entry) bool
type MultiLeafFieldComparator ¶
type MultiLeafFieldComparator struct {
// contains filtered or unexported fields
}
func NewMultiLeafFieldComparator ¶
func NewMultiLeafFieldComparator(comparators []index.LeafFieldComparator, reverseMul []int) *MultiLeafFieldComparator
func (*MultiLeafFieldComparator) CompareBottom ¶
func (m *MultiLeafFieldComparator) CompareBottom(doc int) (int, error)
func (*MultiLeafFieldComparator) CompareTop ¶
func (m *MultiLeafFieldComparator) CompareTop(doc int) (int, error)
func (*MultiLeafFieldComparator) CompetitiveIterator ¶
func (m *MultiLeafFieldComparator) CompetitiveIterator() (types.DocIdSetIterator, error)
func (*MultiLeafFieldComparator) Copy ¶
func (m *MultiLeafFieldComparator) Copy(slot, doc int) error
func (*MultiLeafFieldComparator) SetBottom ¶
func (m *MultiLeafFieldComparator) SetBottom(slot int) error
func (*MultiLeafFieldComparator) SetHitsThresholdReached ¶
func (m *MultiLeafFieldComparator) SetHitsThresholdReached() error
type MultiTermQuery ¶
type MultiTermQuery interface { index.Query // GetField // Returns the field name for this query GetField() string // GetTermsEnum // Construct the enumeration to be used, expanding the pattern term. // This method should only be called if the field exists // (ie, implementations can assume the field does exist). // This method should not return null (should instead return TermsEnum.EMPTY if no terms match). // The TermsEnum must already be positioned to the first matching term. // The given AttributeSource is passed by the MultiTermQuery.RewriteMethod to // share information between segments, for example TopTermsRewrite uses it to // share maximum competitive boosts GetTermsEnum(terms index.Terms, atts *attribute.Source) (index.TermsEnum, error) // GetRewriteMethod // See Also: setRewriteMethod GetRewriteMethod() RewriteMethod // SetRewriteMethod // Sets the rewrite method to be used when executing the query. You can use one of the four core methods, // or implement your own subclass of MultiTermQuery.RewriteMethod. SetRewriteMethod(method RewriteMethod) }
MultiTermQuery An abstract Query that matches documents containing a subset of terms provided by a FilteredTermsEnum enumeration. This query cannot be used directly; you must subclass it and define getTermsEnum(Terms, AttributeSource) to provide a FilteredTermsEnum that iterates through the terms to be matched. NOTE: if setRewriteMethod is either CONSTANT_SCORE_BOOLEAN_REWRITE or SCORING_BOOLEAN_REWRITE, you may encounter a BooleanQuery.TooManyClauses exception during searching, which happens when the number of terms to be searched exceeds BooleanQuery.getMaxClauseCount(). Setting setRewriteMethod to ConstantScoreRewrite prevents this. The recommended rewrite method is ConstantScoreRewrite: it doesn't spend CPU computing unhelpful scores, and is the most performant rewrite method given the query. If you need scoring (like FuzzyQuery, use MultiTermQuery.TopTermsScoringBooleanQueryRewrite which uses a priority queue to only collect competitive terms and not hit this limitation. Note that org.apache.lucene.queryparser.classic.QueryParser produces MultiTermQueries using ConstantScoreRewrite by default.
type MultiTermQueryConstantScoreWrapper ¶
type MultiTermQueryConstantScoreWrapper struct {
// contains filtered or unexported fields
}
func (*MultiTermQueryConstantScoreWrapper) CreateWeight ¶
func (m *MultiTermQueryConstantScoreWrapper) CreateWeight(searcher index.IndexSearcher, scoreMode index.ScoreMode, boost float64) (index.Weight, error)
func (*MultiTermQueryConstantScoreWrapper) GetField ¶
func (m *MultiTermQueryConstantScoreWrapper) GetField() string
GetField Returns the field name for this query
func (*MultiTermQueryConstantScoreWrapper) GetQuery ¶
func (m *MultiTermQueryConstantScoreWrapper) GetQuery() index.Query
func (*MultiTermQueryConstantScoreWrapper) Rewrite ¶
func (m *MultiTermQueryConstantScoreWrapper) Rewrite(reader index.IndexReader) (index.Query, error)
func (*MultiTermQueryConstantScoreWrapper) String ¶
func (m *MultiTermQueryConstantScoreWrapper) String(field string) string
func (*MultiTermQueryConstantScoreWrapper) Visit ¶
func (m *MultiTermQueryConstantScoreWrapper) Visit(visitor index.QueryVisitor) (err error)
type MultiTermQueryPlus ¶
type MultiTermQueryPlus interface { }
type NamedMatches ¶
type NamedMatches struct {
// contains filtered or unexported fields
}
NamedMatches Utility class to help extract the set of sub queries that have matched from a larger query. Individual subqueries may be wrapped using wrapQuery(String, Query), and the matching queries for a particular document can then be pulled from the parent Query's Matches object by calling findNamedMatches(Matches)
func NewNamedMatches ¶
func NewNamedMatches(in index.Matches, name string) *NamedMatches
func (*NamedMatches) GetMatches ¶
func (n *NamedMatches) GetMatches(field string) (index.MatchesIterator, error)
func (*NamedMatches) GetName ¶
func (n *NamedMatches) GetName() string
func (*NamedMatches) GetSubMatches ¶
func (n *NamedMatches) GetSubMatches() []index.Matches
func (*NamedMatches) Strings ¶
func (n *NamedMatches) Strings() []string
type OneComparatorFieldValueHitQueue ¶
type OneComparatorFieldValueHitQueue struct { *FieldValueHitQueueDefault[*Entry] // contains filtered or unexported fields }
func NewOneComparatorFieldValueHitQueue ¶
func NewOneComparatorFieldValueHitQueue(fields []index.SortField, size int) *OneComparatorFieldValueHitQueue
func (*OneComparatorFieldValueHitQueue) Less ¶
func (o *OneComparatorFieldValueHitQueue) Less(hitA, hitB *Entry) bool
type OptionBM25Similarity ¶
type OptionBM25Similarity func(similarity *optionBM25Similarity)
func WithBM25SimilarityB ¶
func WithBM25SimilarityB(b float64) OptionBM25Similarity
func WithBM25SimilarityK1 ¶
func WithBM25SimilarityK1(k1 float64) OptionBM25Similarity
type PagingFieldCollector ¶
type PagingFieldCollector struct { *TopFieldCollector *TopDocsCollectorDefault[*Entry] // contains filtered or unexported fields }
func NewPagingFieldCollector ¶
func NewPagingFieldCollector(sort index.Sort, queue FieldValueHitQueue[*Entry], after FieldDoc, numHits int, hitsThresholdChecker HitsThresholdChecker, minScoreAcc *MaxScoreAccumulator) (*PagingFieldCollector, error)
func (*PagingFieldCollector) GetLeafCollector ¶
func (p *PagingFieldCollector) GetLeafCollector(ctx context.Context, readerContext index.LeafReaderContext) (index.LeafCollector, error)
type PagingTopScoreDocCollector ¶
type PagingTopScoreDocCollector struct { *BaseTopScoreDocCollector // contains filtered or unexported fields }
func (*PagingTopScoreDocCollector) GetLeafCollector ¶
func (p *PagingTopScoreDocCollector) GetLeafCollector(ctx context.Context, readerContext index.LeafReaderContext) (index.LeafCollector, error)
func (*PagingTopScoreDocCollector) NewTopDocs ¶
func (*PagingTopScoreDocCollector) ScoreMode ¶
func (p *PagingTopScoreDocCollector) ScoreMode() index.ScoreMode
func (*PagingTopScoreDocCollector) TopDocsSize ¶
func (p *PagingTopScoreDocCollector) TopDocsSize() int
type PointInSetQuery ¶
type PointInSetQuery struct {
// contains filtered or unexported fields
}
type PointRangeQuery ¶
type PointRangeQuery struct {
// contains filtered or unexported fields
}
func NewPointRangeQuery ¶
func (*PointRangeQuery) CreateWeight ¶
func (p *PointRangeQuery) CreateWeight(searcher coreIndex.IndexSearcher, scoreMode coreIndex.ScoreMode, boost float64) (coreIndex.Weight, error)
func (*PointRangeQuery) IsPointQuery ¶
func (p *PointRangeQuery) IsPointQuery() bool
func (*PointRangeQuery) Rewrite ¶
func (p *PointRangeQuery) Rewrite(reader coreIndex.IndexReader) (coreIndex.Query, error)
func (*PointRangeQuery) String ¶
func (p *PointRangeQuery) String(field string) string
func (*PointRangeQuery) Visit ¶
func (p *PointRangeQuery) Visit(visitor coreIndex.QueryVisitor) (err error)
type PrefixQuery ¶
type PrefixQuery struct { }
type ReqExclBulkScorer ¶
type ReqExclBulkScorer struct {
// contains filtered or unexported fields
}
func (*ReqExclBulkScorer) Cost ¶
func (r *ReqExclBulkScorer) Cost() int64
func (*ReqExclBulkScorer) Score ¶
func (r *ReqExclBulkScorer) Score(collector index.LeafCollector, acceptDocs util.Bits, minDoc, maxDoc int) (int, error)
type ReqExclScorer ¶
type ReqExclScorer struct { *BaseScorer // contains filtered or unexported fields }
ReqExclScorer A Scorer for queries with a required subscorer and an excluding (prohibited) sub Scorer.
func NewReqExclScorer ¶
func NewReqExclScorer(reqScorer, exclScorer index.Scorer) *ReqExclScorer
func (*ReqExclScorer) DocID ¶
func (r *ReqExclScorer) DocID() int
func (*ReqExclScorer) GetMaxScore ¶
func (r *ReqExclScorer) GetMaxScore(upTo int) (float64, error)
func (*ReqExclScorer) Iterator ¶
func (r *ReqExclScorer) Iterator() types.DocIdSetIterator
func (*ReqExclScorer) Score ¶
func (r *ReqExclScorer) Score() (float64, error)
func (*ReqExclScorer) TwoPhaseIterator ¶
func (r *ReqExclScorer) TwoPhaseIterator() index.TwoPhaseIterator
type ReqOptSumScorer ¶
type ReqOptSumScorer struct { *BaseScorer // contains filtered or unexported fields }
ReqOptSumScorer A Scorer for queries with a required part and an optional part. Delays skipTo() on the optional part until a score() is needed.
GPT3.5:
在Lucene中,ReqOptSumScorer是一个用于布尔查询的评分器(scorer)。 它是由ReqScorer和OptScorer组合而成,用于计算布尔查询的相关性得分。
ReqScorer(必须匹配评分器)是一个评分器,用于计算满足所有必须(必须出现)子查询的文档的得分。 它将文档与每个子查询进行匹配,并将匹配的文档的得分进行累加。ReqScorer的得分是所有必须子查询的得分之和。
OptScorer(可选匹配评分器)是一个评分器,用于计算满足任意可选(可选出现)子查询的文档的得分。 它将文档与每个可选子查询进行匹配,并将匹配的文档的得分进行累加。OptScorer的得分是所有可选子查询的得分之和。
ReqOptSumScorer将ReqScorer和OptScorer的得分进行相加,得到最终的文档得分。 这意味着文档必须匹配所有必须子查询,并且可以匹配任意可选子查询。
使用ReqOptSumScorer可以实现布尔查询的组合逻辑,例如"must"(必须匹配)和"should"(可选匹配)的组合。 它允许您根据查询要求计算文档的相关性得分,并根据得分对文档进行排序和排名。
请注意,以上是对ReqOptSumScorer的基本解释,实际的实现和使用方式可能会有所不同,具体取决于Lucene版本和上下文环境。
func NewReqOptSumScorer ¶
func NewReqOptSumScorer(reqScorer, optScorer index.Scorer, scoreMode index.ScoreMode) (*ReqOptSumScorer, error)
NewReqOptSumScorer Construct a ReqOptScorer. reqScorer: The required scorer. This must match. optScorer: The optional scorer. This is used for scoring only. scoreMode: How the produced scorers will be consumed.
func (*ReqOptSumScorer) AdvanceShallow ¶
func (r *ReqOptSumScorer) AdvanceShallow(target int) (int, error)
func (*ReqOptSumScorer) DocID ¶
func (r *ReqOptSumScorer) DocID() int
func (*ReqOptSumScorer) GetMaxScore ¶
func (r *ReqOptSumScorer) GetMaxScore(upTo int) (float64, error)
func (*ReqOptSumScorer) Iterator ¶
func (r *ReqOptSumScorer) Iterator() types.DocIdSetIterator
func (*ReqOptSumScorer) Score ¶
func (r *ReqOptSumScorer) Score() (float64, error)
func (*ReqOptSumScorer) SetMinCompetitiveScore ¶
func (r *ReqOptSumScorer) SetMinCompetitiveScore(minScore float64) error
func (*ReqOptSumScorer) TwoPhaseIterator ¶
func (r *ReqOptSumScorer) TwoPhaseIterator() index.TwoPhaseIterator
type RewriteMethod ¶
type RewriteMethod interface { Rewrite(reader index.IndexReader, query MultiTermQuery) (index.Query, error) // GetTermsEnum // Returns the MultiTermQuerys TermsEnum // See Also: getTermsEnum(Terms, AttributeSource) GetTermsEnum(query MultiTermQuery, terms index.Terms, atts *attribute.Source) (index.TermsEnum, error) }
RewriteMethod Abstract class that defines how the query is rewritten.
type ScoreAndDoc ¶
type ScoreAndDoc struct { *BaseScorable // contains filtered or unexported fields }
func NewScoreAndDoc ¶
func NewScoreAndDoc() *ScoreAndDoc
func (*ScoreAndDoc) DocID ¶
func (s *ScoreAndDoc) DocID() int
func (*ScoreAndDoc) Score ¶
func (s *ScoreAndDoc) Score() (float64, error)
type ScoreMergeSortQueue ¶
type ScoreMergeSortQueue struct { *structure.PriorityQueue[*ShardRef] // contains filtered or unexported fields }
func NewScoreMergeSortQueue ¶
func NewScoreMergeSortQueue(shardHits []index.TopDocs) *ScoreMergeSortQueue
type ScoreRange ¶ added in v0.0.2
type ScorerLeafCollector ¶
type ScorerLeafCollector struct {
// contains filtered or unexported fields
}
type ShardRef ¶
type ShardRef struct {
// contains filtered or unexported fields
}
ShardRef Refers to one hit:
func NewShardRef ¶
type SimpleCollector ¶
type SimpleCollector interface { index.Collector index.LeafCollector // DoSetNextReader // This method is called before collecting context. DoSetNextReader(context index.LeafReaderContext) error }
SimpleCollector Base Collector implementation that is used to collect all contexts.
type SimpleCollectorSPI ¶
type SimpleFieldCollector ¶
type SimpleFieldCollector struct { *TopFieldCollector *TopDocsCollectorDefault[*Entry] // contains filtered or unexported fields }
func NewSimpleFieldCollector ¶
func NewSimpleFieldCollector(sort index.Sort, queue FieldValueHitQueue[*Entry], numHits int, hitsThresholdChecker HitsThresholdChecker, minScoreAcc *MaxScoreAccumulator) (*SimpleFieldCollector, error)
func (*SimpleFieldCollector) GetLeafCollector ¶
func (s *SimpleFieldCollector) GetLeafCollector(ctx context.Context, readerContext index.LeafReaderContext) (index.LeafCollector, error)
type SimpleTopScoreDocCollector ¶
type SimpleTopScoreDocCollector struct {
*BaseTopScoreDocCollector
}
func (*SimpleTopScoreDocCollector) GetLeafCollector ¶
func (s *SimpleTopScoreDocCollector) GetLeafCollector(ctx context.Context, readerContext index.LeafReaderContext) (index.LeafCollector, error)
func (*SimpleTopScoreDocCollector) ScoreMode ¶
func (s *SimpleTopScoreDocCollector) ScoreMode() index.ScoreMode
type StartDISIWrapper ¶
type StartDISIWrapper struct {
// contains filtered or unexported fields
}
func NewStartDISIWrapper ¶
func NewStartDISIWrapper(in types.DocIdSetIterator) *StartDISIWrapper
func (*StartDISIWrapper) Cost ¶
func (s *StartDISIWrapper) Cost() int64
func (*StartDISIWrapper) DocID ¶
func (s *StartDISIWrapper) DocID() int
func (*StartDISIWrapper) SlowAdvance ¶
type TermInSetQuery ¶
type TermInSetQuery struct {
// contains filtered or unexported fields
}
TermInSetQuery Specialization for a disjunction over many terms that behaves like a ConstantScoreQuery over a BooleanQuery containing only BooleanClause.Occur.OccurShould clauses.
For instance in the following example, both q1 and q2 would yield the same scores: Query q1 = new TermInSetQuery("field", new BytesRef("foo"), new BytesRef("bar"));
BooleanQuery bq = new BooleanQuery(); bq.add(new TermQuery(new Term("field", "foo")), Occur.OccurShould); bq.add(new TermQuery(new Term("field", "bar")), Occur.OccurShould); Query q2 = new ConstantScoreQuery(bq);
When there are few terms, this query executes like a regular disjunction. However, when there are many terms, instead of merging iterators on the fly, it will populate a bit set with matching docs and return a Scorer over this bit set.
NOTE: This query produces scores that are equal to its boost
func (*TermInSetQuery) CreateWeight ¶
func (t *TermInSetQuery) CreateWeight(searcher index.IndexSearcher, scoreMode index.ScoreMode, boost float64) (index.Weight, error)
func (*TermInSetQuery) Rewrite ¶
func (t *TermInSetQuery) Rewrite(reader index.IndexReader) (index.Query, error)
func (*TermInSetQuery) String ¶
func (t *TermInSetQuery) String(field string) string
func (*TermInSetQuery) Visit ¶
func (t *TermInSetQuery) Visit(visitor index.QueryVisitor) error
type TermMatchesIterator ¶
type TermMatchesIterator struct {
// contains filtered or unexported fields
}
TermMatchesIterator A MatchesIterator over a single term's postings list
func NewTermMatchesIterator ¶
func NewTermMatchesIterator(query index.Query, pe index.PostingsEnum) (*TermMatchesIterator, error)
func (*TermMatchesIterator) EndOffset ¶
func (t *TermMatchesIterator) EndOffset() (int, error)
func (*TermMatchesIterator) EndPosition ¶
func (t *TermMatchesIterator) EndPosition() int
func (*TermMatchesIterator) GetQuery ¶
func (t *TermMatchesIterator) GetQuery() index.Query
func (*TermMatchesIterator) GetSubMatches ¶
func (t *TermMatchesIterator) GetSubMatches() (index.MatchesIterator, error)
func (*TermMatchesIterator) Next ¶
func (t *TermMatchesIterator) Next() (bool, error)
func (*TermMatchesIterator) StartOffset ¶
func (t *TermMatchesIterator) StartOffset() (int, error)
func (*TermMatchesIterator) StartPosition ¶
func (t *TermMatchesIterator) StartPosition() int
type TermQuery ¶
type TermQuery struct {
// contains filtered or unexported fields
}
TermQuery A Query that matches documents containing a term. This may be combined with other terms with a BooleanQuery.
func NewTermQuery ¶
func NewTermQueryV1 ¶
func NewTermQueryV1(term index.Term, states *coreIndex.TermStates) *TermQuery
NewTermQueryV1 Expert: constructs a TermQuery that will use the provided docFreq instead of looking up the docFreq against the searcher.
func (*TermQuery) CreateWeight ¶
func (*TermQuery) NewTermWeight ¶
func (t *TermQuery) NewTermWeight(searcher index.IndexSearcher, scoreMode index.ScoreMode, boost float64, termStates *coreIndex.TermStates) (*TermWeight, error)
type TermRangeQuery ¶
type TermRangeQuery struct { }
type TermScorer ¶
type TermScorer struct { *BaseScorer // contains filtered or unexported fields }
TermScorer Expert: A Scorer for documents matching a Term.
func NewTermScorerWithImpacts ¶
func NewTermScorerWithImpacts(weight index.Weight, impactsEnum index.ImpactsEnum, docScorer *LeafSimScorer) *TermScorer
func NewTermScorerWithPostings ¶
func NewTermScorerWithPostings(weight index.Weight, postingsEnum index.PostingsEnum, docScorer *LeafSimScorer) *TermScorer
func (*TermScorer) DocID ¶
func (t *TermScorer) DocID() int
func (*TermScorer) Freq ¶
func (t *TermScorer) Freq() (int, error)
func (*TermScorer) GetChildren ¶
func (t *TermScorer) GetChildren() ([]index.ChildScorable, error)
func (*TermScorer) GetMaxScore ¶
func (t *TermScorer) GetMaxScore(upTo int) (float64, error)
func (*TermScorer) GetWeight ¶
func (t *TermScorer) GetWeight() index.Weight
func (*TermScorer) Iterator ¶
func (t *TermScorer) Iterator() types.DocIdSetIterator
func (*TermScorer) Score ¶
func (t *TermScorer) Score() (float64, error)
func (*TermScorer) SetMinCompetitiveScore ¶
func (t *TermScorer) SetMinCompetitiveScore(minScore float64) error
func (*TermScorer) SmoothingScore ¶
func (t *TermScorer) SmoothingScore(docId int) (float64, error)
func (*TermScorer) TwoPhaseIterator ¶
func (t *TermScorer) TwoPhaseIterator() index.TwoPhaseIterator
type TermWeight ¶
type TermWeight struct { *BaseWeight *TermQuery // contains filtered or unexported fields }
func (*TermWeight) Explain ¶
func (t *TermWeight) Explain(context index.LeafReaderContext, doc int) (types.Explanation, error)
func (*TermWeight) ExtractTerms ¶
func (*TermWeight) GetQuery ¶
func (t *TermWeight) GetQuery() index.Query
func (*TermWeight) IsCacheable ¶
func (t *TermWeight) IsCacheable(ctx index.LeafReaderContext) bool
func (*TermWeight) Scorer ¶
func (t *TermWeight) Scorer(ctx index.LeafReaderContext) (index.Scorer, error)
type TimSort ¶
type TimSort []types.DocIdSetIterator
type TimSortBitSet ¶
type TimSortBitSet []*coreIndex.BitSetIterator
func (TimSortBitSet) Len ¶
func (t TimSortBitSet) Len() int
func (TimSortBitSet) Less ¶
func (t TimSortBitSet) Less(i, j int) bool
func (TimSortBitSet) Swap ¶
func (t TimSortBitSet) Swap(i, j int)
type TimSortTwoPhase ¶
type TimSortTwoPhase []index.TwoPhaseIterator
func (TimSortTwoPhase) Len ¶
func (t TimSortTwoPhase) Len() int
func (TimSortTwoPhase) Less ¶
func (t TimSortTwoPhase) Less(i, j int) bool
func (TimSortTwoPhase) Swap ¶
func (t TimSortTwoPhase) Swap(i, j int)
type TopDocsCollector ¶
type TopDocsCollector interface { index.Collector // PopulateResults // Populates the results array with the ScoreDoc instances. // This can be overridden in case a different ScoreDoc type should be returned. PopulateResults(results []index.ScoreDoc, howMany int) error // NewTopDocs // Returns a TopDocs instance containing the given results. // If results is null it means there are no results to return, either because // there were 0 calls to collect() or because the arguments to topDocs were invalid. NewTopDocs(results []index.ScoreDoc, howMany int) (index.TopDocs, error) // GetTotalHits // The total number of documents that matched this query. GetTotalHits() int // TopDocsSize // The number of valid PQ entries TopDocsSize() int // TopDocs // Returns the top docs that were collected by this collector. TopDocs() (index.TopDocs, error) // TopDocsFrom // Returns the documents in the range [start .. pq.size()) that were collected by this collector. // Note that if start >= pq.size(), an empty TopDocs is returned. This method is convenient to // call if the application always asks for the last results, starting from the last 'page'. // NOTE: you cannot call this method more than once for each search execution. // If you need to call it more than once, passing each time a different start, // you should call topDocs() and work with the returned TopDocs object, // which will contain all the results this search execution collected. TopDocsFrom(start int) (index.TopDocs, error) // TopDocsRange // Returns the documents in the range [start .. start+howMany) that were collected by this collector. // Note that if start >= pq.size(), an empty TopDocs is returned, and if pq.size() - start < howMany, // then only the available documents in [start .. pq.size()) are returned. // This method is useful to call in case pagination of search results is allowed by the search application, // as well as it attempts to optimize the memory used by allocating only as much as requested by howMany. // NOTE: you cannot call this method more than once for each search execution. // If you need to call it more than once, passing each time a different range, // you should call topDocs() and work with the returned TopDocs object, // which will contain all the results this search execution collected. TopDocsRange(start, howMany int) (index.TopDocs, error) }
TopDocsCollector A base class for all collectors that return a TopDocs output. This collector allows easy extension by providing a single constructor which accepts a PriorityQueue as well as protected members for that priority queue and a counter of the number of total hits. Extending classes can override any of the methods to provide their own implementation, as well as avoid the use of the priority queue entirely by passing null to TopDocsCollector(PriorityQueue). In that case however, you might want to consider overriding all methods, in order to avoid a NullPointerException.
func TopTopFieldCollectorCreate ¶
func TopTopFieldCollectorCreate(sort index.Sort, numHits int, after FieldDoc, hitsThresholdChecker HitsThresholdChecker, minScoreAcc *MaxScoreAccumulator) (TopDocsCollector, error)
type TopDocsCollectorDefault ¶
func (*TopDocsCollectorDefault[T]) GetTotalHits ¶
func (t *TopDocsCollectorDefault[T]) GetTotalHits() int
func (*TopDocsCollectorDefault[T]) NewTopDocs ¶
func (*TopDocsCollectorDefault[T]) PopulateResults ¶
func (t *TopDocsCollectorDefault[T]) PopulateResults(results []index.ScoreDoc, howMany int) error
func (*TopDocsCollectorDefault[T]) TopDocs ¶
func (t *TopDocsCollectorDefault[T]) TopDocs() (index.TopDocs, error)
func (*TopDocsCollectorDefault[T]) TopDocsFrom ¶
func (t *TopDocsCollectorDefault[T]) TopDocsFrom(start int) (index.TopDocs, error)
func (*TopDocsCollectorDefault[T]) TopDocsRange ¶
func (t *TopDocsCollectorDefault[T]) TopDocsRange(start, howMany int) (index.TopDocs, error)
func (*TopDocsCollectorDefault[T]) TopDocsSize ¶
func (t *TopDocsCollectorDefault[T]) TopDocsSize() int
type TopFieldCollector ¶
type TopFieldCollector struct { *TopDocsCollectorDefault[*Entry] // contains filtered or unexported fields }
func (*TopFieldCollector) ScoreMode ¶
func (t *TopFieldCollector) ScoreMode() index.ScoreMode
type TopFieldDocs ¶
type TopFieldDocs struct { *BaseTopDocs // contains filtered or unexported fields }
func NewTopFieldDocs ¶
func NewTopFieldDocs(totalHits *index.TotalHits, scoreDocs []index.ScoreDoc, fields []index.SortField) *TopFieldDocs
NewTopFieldDocs Creates one of these objects. totalHits – Total number of hits for the query. scoreDocs – The top hits for the query. fields – The sort criteria used to find the top hits.
func (*TopFieldDocs) GetFields ¶
func (t *TopFieldDocs) GetFields() []index.SortField
type TopScoreDocCollector ¶
type TopScoreDocCollector interface { TopDocsCollector }
TopScoreDocCollector A Collector implementation that collects the top-scoring hits, returning them as a TopDocs. This is used by IndexSearcher to implement TopDocs-based search. Hits are sorted by score descending and then (when the scores are tied) docID ascending. When you create an instance of this collector you should know in advance whether documents are going to be collected in doc Id order or not.
NOTE: The values Float.NaN and Float.NEGATIVE_INFINITY are not valid scores. This collector will not properly collect hits with such scores.
func NewPagingTopScoreDocCollector ¶
func NewPagingTopScoreDocCollector(hits int, after index.ScoreDoc, checker HitsThresholdChecker, acc *MaxScoreAccumulator) (TopScoreDocCollector, error)
func NewSimpleTopScoreDocCollector ¶
func NewSimpleTopScoreDocCollector(numHits int, hitsThresholdChecker HitsThresholdChecker, minScoreAcc *MaxScoreAccumulator) (TopScoreDocCollector, error)
func TopScoreDocCollectorCreate ¶
func TopScoreDocCollectorCreate(numHits int, after index.ScoreDoc, hitsThresholdChecker HitsThresholdChecker, minScoreAcc *MaxScoreAccumulator) (TopScoreDocCollector, error)
type TotalHitCountCollector ¶
type TotalHitCountCollector struct { *BaseSimpleCollector // contains filtered or unexported fields }
func NewTotalHitCountCollector ¶
func NewTotalHitCountCollector() *TotalHitCountCollector
func (*TotalHitCountCollector) Collect ¶
func (t *TotalHitCountCollector) Collect(ctx context.Context, doc int) error
func (TotalHitCountCollector) CompetitiveIterator ¶
func (TotalHitCountCollector) CompetitiveIterator() (types.DocIdSetIterator, error)
func (*TotalHitCountCollector) GetTotalHits ¶
func (t *TotalHitCountCollector) GetTotalHits() int
func (*TotalHitCountCollector) ScoreMode ¶
func (t *TotalHitCountCollector) ScoreMode() index.ScoreMode
type TwoPhase ¶
type TwoPhase struct { }
func (*TwoPhase) Approximation ¶
func (t *TwoPhase) Approximation() types.DocIdSetIterator
type WANDScorer ¶
type WANDScorer struct { *BaseScorer // contains filtered or unexported fields }
WANDScorer This implements the WAND (Weak AND) algorithm for dynamic pruning described in "Efficient Query Evaluation using a Two-Level Retrieval Process" by Broder, Carmel, Herscovici, Soffer and Zien. Enhanced with techniques described in "Faster Top-k Document Retrieval Using Block-Max Indexes" by Ding and Suel. For scoreMode == ScoreMode.TOP_SCORES, this scorer maintains a feedback loop with the collector in order to know at any time the minimum score that is required in order for a hit to be competitive.
The implementation supports both minCompetitiveScore by enforce that ∑ max_score >= minCompetitiveScore, and minShouldMatch by enforcing freq >= minShouldMatch. It keeps sub scorers in 3 different places: - tail: a heap that contains scorers that are behind the desired doc ID. These scorers are ordered by cost so that we can advance the least costly ones first. - lead: a linked list of scorer that are positioned on the desired doc ID - head: a heap that contains scorers which are beyond the desired doc ID, ordered by doc ID in order to move quickly to the next candidate. When scoreMode == ScoreMode.TOP_SCORES, it leverages the max score from each scorer in order to know when it may call DocIdSetIterator.advance rather than DocIdSetIterator.nextDoc to move to the next competitive hit. When scoreMode != ScoreMode.TOP_SCORES, block-max scoring related logic is skipped. Finding the next match consists of first setting the desired doc ID to the least entry in 'head', and then advance 'tail' until there is a match, by meeting the configured freq >= minShouldMatch and / or ∑ max_score >= minCompetitiveScore requirements.
func (*WANDScorer) DocID ¶
func (w *WANDScorer) DocID() int
func (*WANDScorer) GetMaxScore ¶
func (w *WANDScorer) GetMaxScore(upTo int) (float64, error)
func (*WANDScorer) Iterator ¶
func (w *WANDScorer) Iterator() types.DocIdSetIterator
func (*WANDScorer) Score ¶
func (w *WANDScorer) Score() (float64, error)
type WeightScorer ¶
type WeightScorer interface {
Scorer(ctx index.LeafReaderContext) (index.Scorer, error)
}
Source Files
¶
- automatonquery.go
- bitdocidset.go
- blockmaxconjunctionscorer.go
- blockmaxdisi.go
- boolean2scorersupplier.go
- booleanclause.go
- booleanquery.go
- booleanweight.go
- boostquery.go
- bulkscorer.go
- collector.go
- collectormanager.go
- conjunctiondisi.go
- conjunctionscorer.go
- constantscorequery.go
- constantscorescorer.go
- constantscoreweight.go
- disipriorityqueue.go
- disjunctionmatchesiterator.go
- disjunctionmaxquery.go
- disjunctionscorer.go
- disjunctionsumscorer.go
- docidset.go
- docidsetbuilder.go
- docvaluesfieldexistsquery.go
- fielddoc.go
- fieldvaluehitqueue.go
- filterscorer.go
- hitsthresholdchecker.go
- impactsdisi.go
- indexsearcher.go
- intarraydocIdset.go
- leafcollector.go
- leafsimscorer.go
- matchalldocsquery.go
- matches.go
- matchnodocsquery.go
- matchutils.go
- maxscoreaccumulator.go
- maxscorecache.go
- maxscoresumpropagator.go
- multileaffieldcomparator.go
- multitermquery.go
- namedmatches.go
- pointinsetquery.go
- pointrangequery.go
- prefixquery.go
- reqexclbulkscorer.go
- reqexclscorer.go
- reqoptsumscorer.go
- scorable.go
- scoreanddoc.go
- scoredoc.go
- scoremode.go
- scorer.go
- scorerutil.go
- similaritybm25.go
- terminsetquery.go
- termmatchesiterator.go
- termquery.go
- termrangequery.go
- termscorer.go
- topdocs.go
- topdocscollector.go
- topfieldcollector.go
- topfielddocs.go
- topscoredoccollector.go
- twophaseiterator.go
- wandscorer.go
- weight.go