java.lang.Object
org.apache.lucene.search.BulkScorer
org.apache.lucene.search.BlockMaxConjunctionBulkScorer
BulkScorer implementation of
BlockMaxConjunctionScorer that focuses on top-level
conjunctions over clauses that do not have two-phase iterators. Use a Weight.DefaultBulkScorer
around a BlockMaxConjunctionScorer if you need two-phase support. Another difference with
BlockMaxConjunctionScorer is that this scorer computes scores on the fly in order to be
able to skip evaluating more clauses if the total score would be under the minimum competitive
score anyway. This generally works well because computing a score is cheaper than decoding a
block of postings.-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final DocIdSetIterator[]private final DocIdSetIteratorprivate final DocIdSetIteratorprivate final intprivate final BlockMaxConjunctionBulkScorer.DocAndScoreprivate final Scorerprivate final Scorerprivate final Scorer[]private final double[] -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate floatcomputeMaxScore(int windowMin, int windowMax) longcost()Same asDocIdSetIterator.cost()for bulk scorers.intscore(LeafCollector collector, Bits acceptDocs, int min, int max) Collects matching documents in a range and return an estimation of the next matching document which is on or aftermax.private voidscoreWindow(LeafCollector collector, Bits acceptDocs, int min, int max, float maxWindowScore) Methods inherited from class org.apache.lucene.search.BulkScorer
score
-
Field Details
-
scorers
-
iterators
-
lead1
-
lead2
-
scorer1
-
scorer2
-
scorable
-
sumOfOtherClauses
private final double[] sumOfOtherClauses -
maxDoc
private final int maxDoc
-
-
Constructor Details
-
BlockMaxConjunctionBulkScorer
BlockMaxConjunctionBulkScorer(int maxDoc, List<Scorer> scorers) throws IOException - Throws:
IOException
-
-
Method Details
-
computeMaxScore
- Throws:
IOException
-
score
Description copied from class:BulkScorerCollects matching documents in a range and return an estimation of the next matching document which is on or aftermax.The return value must be:
- >=
max, DocIdSetIterator.NO_MORE_DOCSif there are no more matches,- <= the first matching document that is >=
maxotherwise.
minis the minimum document to be considered for matching. All documents strictly before this value must be ignored.Although
maxwould be a legal return value for this method, higher values might help callers skip more efficiently over non-matching portions of the docID space.For instance, a
Scorer-based implementation could look like below:private final Scorer scorer; // set via constructor public int score(LeafCollector collector, Bits acceptDocs, int min, int max) throws IOException { collector.setScorer(scorer); int doc = scorer.docID(); if (doc < min) { doc = scorer.advance(min); } while (doc < max) { if (acceptDocs == null || acceptDocs.get(doc)) { collector.collect(doc); } doc = scorer.nextDoc(); } return doc; }- Specified by:
scorein classBulkScorer- Parameters:
collector- The collector to which all matching documents are passed.acceptDocs-Bitsthat represents the allowed documents to match, ornullif they are all allowed to match.min- Score starting at, including, this documentmax- Score up to, but not including, this doc- Returns:
- an under-estimation of the next matching doc after max
- Throws:
IOException
- >=
-
scoreWindow
private void scoreWindow(LeafCollector collector, Bits acceptDocs, int min, int max, float maxWindowScore) throws IOException - Throws:
IOException
-
cost
public long cost()Description copied from class:BulkScorerSame asDocIdSetIterator.cost()for bulk scorers.- Specified by:
costin classBulkScorer
-