- java.lang.Object
-
- org.apache.lucene.search.BulkScorer
-
- org.apache.lucene.search.MaxScoreBulkScorer
-
final class MaxScoreBulkScorer extends BulkScorer
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private class
MaxScoreBulkScorer.ScoreAndDoc
-
Field Summary
Fields Modifier and Type Field Description (package private) DisiWrapper[]
allScorers
private long
cost
private DisiPriorityQueue
essentialQueue
(package private) int
firstEssentialScorer
(package private) int
firstRequiredScorer
(package private) static int
INNER_WINDOW_SIZE
private int
maxDoc
(package private) double[]
maxScoreSums
(package private) float
minCompetitiveScore
private MaxScoreBulkScorer.ScoreAndDoc
scorable
private DisiWrapper[]
scratch
private long[]
windowMatches
private double[]
windowScores
-
Constructor Summary
Constructors Constructor Description MaxScoreBulkScorer(int maxDoc, java.util.List<Scorer> scorers)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private int
computeOuterWindowMax(int windowMin)
long
cost()
Same asDocIdSetIterator.cost()
for bulk scorers.private int
nextCandidate(int rangeEnd)
Return the next candidate on or afterrangeEnd
.(package private) boolean
partitionScorers()
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
scoreInnerWindow(LeafCollector collector, Bits acceptDocs, int max)
private void
scoreInnerWindowAsConjunction(LeafCollector collector, Bits acceptDocs, int max)
private void
scoreInnerWindowMultipleEssentialClauses(LeafCollector collector, Bits acceptDocs, int max)
private void
scoreInnerWindowSingleEssentialClause(LeafCollector collector, Bits acceptDocs, int upTo)
private void
scoreNonEssentialClauses(LeafCollector collector, int doc, double essentialScore, int numNonEssentialClauses)
(package private) void
updateMaxWindowScores(int windowMin, int windowMax)
-
Methods inherited from class org.apache.lucene.search.BulkScorer
score
-
-
-
-
Field Detail
-
INNER_WINDOW_SIZE
static final int INNER_WINDOW_SIZE
- See Also:
- Constant Field Values
-
maxDoc
private final int maxDoc
-
allScorers
final DisiWrapper[] allScorers
-
scratch
private final DisiWrapper[] scratch
-
essentialQueue
private final DisiPriorityQueue essentialQueue
-
firstEssentialScorer
int firstEssentialScorer
-
firstRequiredScorer
int firstRequiredScorer
-
cost
private final long cost
-
minCompetitiveScore
float minCompetitiveScore
-
scorable
private MaxScoreBulkScorer.ScoreAndDoc scorable
-
maxScoreSums
final double[] maxScoreSums
-
windowMatches
private final long[] windowMatches
-
windowScores
private final double[] windowScores
-
-
Constructor Detail
-
MaxScoreBulkScorer
MaxScoreBulkScorer(int maxDoc, java.util.List<Scorer> scorers) throws java.io.IOException
- Throws:
java.io.IOException
-
-
Method Detail
-
score
public int score(LeafCollector collector, Bits acceptDocs, int min, int max) throws java.io.IOException
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:
java.io.IOException
- >=
-
scoreInnerWindow
private void scoreInnerWindow(LeafCollector collector, Bits acceptDocs, int max) throws java.io.IOException
- Throws:
java.io.IOException
-
scoreInnerWindowSingleEssentialClause
private void scoreInnerWindowSingleEssentialClause(LeafCollector collector, Bits acceptDocs, int upTo) throws java.io.IOException
- Throws:
java.io.IOException
-
scoreInnerWindowAsConjunction
private void scoreInnerWindowAsConjunction(LeafCollector collector, Bits acceptDocs, int max) throws java.io.IOException
- Throws:
java.io.IOException
-
scoreInnerWindowMultipleEssentialClauses
private void scoreInnerWindowMultipleEssentialClauses(LeafCollector collector, Bits acceptDocs, int max) throws java.io.IOException
- Throws:
java.io.IOException
-
computeOuterWindowMax
private int computeOuterWindowMax(int windowMin) throws java.io.IOException
- Throws:
java.io.IOException
-
updateMaxWindowScores
void updateMaxWindowScores(int windowMin, int windowMax) throws java.io.IOException
- Throws:
java.io.IOException
-
scoreNonEssentialClauses
private void scoreNonEssentialClauses(LeafCollector collector, int doc, double essentialScore, int numNonEssentialClauses) throws java.io.IOException
- Throws:
java.io.IOException
-
partitionScorers
boolean partitionScorers()
-
nextCandidate
private int nextCandidate(int rangeEnd)
Return the next candidate on or afterrangeEnd
.
-
cost
public long cost()
Description copied from class:BulkScorer
Same asDocIdSetIterator.cost()
for bulk scorers.- Specified by:
cost
in classBulkScorer
-
-