java.lang.Object
org.apache.lucene.search.BulkScorer
org.apache.lucene.search.BooleanScorer
BulkScorer that is used for pure disjunctions and disjunctions that have low values of
BooleanQuery.Builder.setMinimumNumberShouldMatch(int) and dense clauses. This scorer
scores documents by batches of 2048 docs.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static classprivate class(package private) final class(package private) static final class(package private) final class(package private) static final class -
Field Summary
FieldsModifier and TypeFieldDescription(package private) final BooleanScorer.Bucket[](package private) final longprivate final BooleanScorer.DocIdStreamView(package private) final BooleanScorer.HeadPriorityQueue(package private) final BooleanScorer.BulkScorerAndDoc[](package private) static final int(package private) final long[](package private) final int(package private) final boolean(package private) final BooleanScorer.OrCollector(package private) final ScoreAndDoc(package private) static final int(package private) static final int(package private) static final int(package private) static final int(package private) final BooleanScorer.TailPriorityQueue -
Constructor Summary
ConstructorsConstructorDescriptionBooleanScorer(BooleanWeight weight, Collection<BulkScorer> scorers, int minShouldMatch, boolean needsScores) -
Method Summary
Modifier and TypeMethodDescriptionprivate BooleanScorer.BulkScorerAndDocadvance(int min) longcost()Same asDocIdSetIterator.cost()for bulk scorers.private static longcost(Collection<BulkScorer> scorers, int minShouldMatch) 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 BooleanScorer.BulkScorerAndDocscoreWindow(BooleanScorer.BulkScorerAndDoc top, LeafCollector collector, Bits acceptDocs, int min, int max) private voidscoreWindowIntoBitSetAndReplay(LeafCollector collector, Bits acceptDocs, int base, int min, int max, BooleanScorer.BulkScorerAndDoc[] scorers, int numScorers) private voidscoreWindowMultipleScorers(LeafCollector collector, Bits acceptDocs, int windowBase, int windowMin, int windowMax, int maxFreq) private voidscoreWindowSingleScorer(BooleanScorer.BulkScorerAndDoc bulkScorer, LeafCollector collector, Bits acceptDocs, int windowMin, int windowMax, int max) Methods inherited from class org.apache.lucene.search.BulkScorer
score
-
Field Details
-
SHIFT
static final int SHIFT- See Also:
-
SIZE
static final int SIZE- See Also:
-
MASK
static final int MASK- See Also:
-
SET_SIZE
static final int SET_SIZE- See Also:
-
SET_MASK
static final int SET_MASK- See Also:
-
buckets
-
matching
final long[] matching -
leads
-
head
-
tail
-
scoreAndDoc
-
minShouldMatch
final int minShouldMatch -
cost
final long cost -
needsScores
final boolean needsScores -
orCollector
-
docIdStreamView
-
-
Constructor Details
-
BooleanScorer
BooleanScorer(BooleanWeight weight, Collection<BulkScorer> scorers, int minShouldMatch, boolean needsScores)
-
-
Method Details
-
cost
-
cost
public long cost()Description copied from class:BulkScorerSame asDocIdSetIterator.cost()for bulk scorers.- Specified by:
costin classBulkScorer
-
scoreWindowIntoBitSetAndReplay
private void scoreWindowIntoBitSetAndReplay(LeafCollector collector, Bits acceptDocs, int base, int min, int max, BooleanScorer.BulkScorerAndDoc[] scorers, int numScorers) throws IOException - Throws:
IOException
-
advance
- Throws:
IOException
-
scoreWindowMultipleScorers
private void scoreWindowMultipleScorers(LeafCollector collector, Bits acceptDocs, int windowBase, int windowMin, int windowMax, int maxFreq) throws IOException - Throws:
IOException
-
scoreWindowSingleScorer
private void scoreWindowSingleScorer(BooleanScorer.BulkScorerAndDoc bulkScorer, LeafCollector collector, Bits acceptDocs, int windowMin, int windowMax, int max) throws IOException - Throws:
IOException
-
scoreWindow
private BooleanScorer.BulkScorerAndDoc scoreWindow(BooleanScorer.BulkScorerAndDoc top, LeafCollector collector, Bits acceptDocs, int min, int max) throws IOException - 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
- >=
-