java.lang.Object
org.apache.lucene.search.BulkScorer
org.apache.lucene.search.MaxScoreBulkScorer
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescription(package private) final DisiWrapper[]
private final long
private final DisiPriorityQueue
private final DisiWrapper
(package private) int
(package private) int
(package private) static final int
private final int
(package private) final double[]
(package private) float
private int
(package private) float
private int
private int
private final MaxScoreBulkScorer.Score
private final DisiWrapper[]
private final long[]
private final double[]
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate 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
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, DisiWrapper filter) 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
scoreInnerWindowWithFilter
(LeafCollector collector, Bits acceptDocs, int max, DisiWrapper filter) private void
scoreNonEssentialClauses
(LeafCollector collector, int doc, double essentialScore, int numNonEssentialClauses) (package private) void
updateMaxWindowScores
(int windowMin, int windowMax)
-
Field Details
-
INNER_WINDOW_SIZE
static final int INNER_WINDOW_SIZE- See Also:
-
maxDoc
private final int maxDoc -
allScorers
-
scratch
-
essentialQueue
-
firstEssentialScorer
int firstEssentialScorer -
firstRequiredScorer
int firstRequiredScorer -
nextMinCompetitiveScore
float nextMinCompetitiveScore -
cost
private final long cost -
minCompetitiveScore
float minCompetitiveScore -
scorable
-
maxScoreSums
final double[] maxScoreSums -
filter
-
windowMatches
private final long[] windowMatches -
windowScores
private final double[] windowScores -
numOuterWindows
private int numOuterWindows -
numCandidates
private int numCandidates -
minWindowSize
private int minWindowSize
-
-
Constructor Details
-
MaxScoreBulkScorer
MaxScoreBulkScorer(int maxDoc, List<Scorer> scorers, Scorer filter) throws IOException - Throws:
IOException
-
-
Method Details
-
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
- >=
-
scoreInnerWindow
private void scoreInnerWindow(LeafCollector collector, Bits acceptDocs, int max, DisiWrapper filter) throws IOException - Throws:
IOException
-
scoreInnerWindowWithFilter
private void scoreInnerWindowWithFilter(LeafCollector collector, Bits acceptDocs, int max, DisiWrapper filter) throws IOException - Throws:
IOException
-
scoreInnerWindowSingleEssentialClause
private void scoreInnerWindowSingleEssentialClause(LeafCollector collector, Bits acceptDocs, int upTo) throws IOException - Throws:
IOException
-
scoreInnerWindowAsConjunction
private void scoreInnerWindowAsConjunction(LeafCollector collector, Bits acceptDocs, int max) throws IOException - Throws:
IOException
-
scoreInnerWindowMultipleEssentialClauses
private void scoreInnerWindowMultipleEssentialClauses(LeafCollector collector, Bits acceptDocs, int max) throws IOException - Throws:
IOException
-
computeOuterWindowMax
- Throws:
IOException
-
updateMaxWindowScores
- Throws:
IOException
-
scoreNonEssentialClauses
private void scoreNonEssentialClauses(LeafCollector collector, int doc, double essentialScore, int numNonEssentialClauses) throws IOException - Throws:
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
-