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 class
private 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 long
(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 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.BulkScorerAndDoc
advance
(int min) long
cost()
Same asDocIdSetIterator.cost()
for bulk scorers.private static long
cost
(Collection<BulkScorer> scorers, int minShouldMatch) int
score
(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 void
scoreDocument
(LeafCollector collector, int base, int i) private void
scoreMatches
(LeafCollector collector, int base) private BooleanScorer.BulkScorerAndDoc
scoreWindow
(BooleanScorer.BulkScorerAndDoc top, LeafCollector collector, Bits acceptDocs, int min, int max) private void
scoreWindowIntoBitSetAndReplay
(LeafCollector collector, Bits acceptDocs, int base, int min, int max, BooleanScorer.BulkScorerAndDoc[] scorers, int numScorers) private void
scoreWindowMultipleScorers
(LeafCollector collector, Bits acceptDocs, int windowBase, int windowMin, int windowMax, int maxFreq) private void
scoreWindowSingleScorer
(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 -
orCollector
-
-
Constructor Details
-
BooleanScorer
BooleanScorer(BooleanWeight weight, Collection<BulkScorer> scorers, int minShouldMatch, boolean needsScores)
-
-
Method Details
-
cost
-
cost
public long cost()Description copied from class:BulkScorer
Same asDocIdSetIterator.cost()
for bulk scorers.- Specified by:
cost
in classBulkScorer
-
scoreDocument
- Throws:
IOException
-
scoreMatches
- Throws:
IOException
-
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:BulkScorer
Collects 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_DOCS
if there are no more matches,- <= the first matching document that is >=
max
otherwise.
min
is the minimum document to be considered for matching. All documents strictly before this value must be ignored.Although
max
would 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:
score
in classBulkScorer
- Parameters:
collector
- The collector to which all matching documents are passed.acceptDocs
-Bits
that represents the allowed documents to match, ornull
if 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
- >=
-