java.lang.Object
org.apache.lucene.search.BulkScorer
org.apache.lucene.facet.DrillSidewaysScorer
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static class
private final class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Comparator
<DrillSidewaysScorer.DocsAndCost> private final DocIdSetIterator
private final DocIdSetIterator
private final Scorer
private final TwoPhaseIterator
private static final int
private int
private float
private final LeafReaderContext
private final DrillSidewaysScorer.DocsAndCost[]
private static final int
(package private) final boolean
private static final Comparator
<DrillSidewaysScorer.DocsAndCost> -
Constructor Summary
ConstructorsConstructorDescriptionDrillSidewaysScorer
(LeafReaderContext context, Scorer baseScorer, DrillSidewaysScorer.DocsAndCost[] dims, boolean scoreSubDocsAtOnce) -
Method Summary
Modifier and TypeMethodDescriptionprivate static int
advanceIfBehind
(int docID, DocIdSetIterator iterator) private void
collectHit
(LeafCollector collector, List<DrillSidewaysScorer.DocsAndCost> dims) private void
collectHit
(LeafCollector collector, DrillSidewaysScorer.DocsAndCost dim) private void
collectHit
(LeafCollector collector, DrillSidewaysScorer.DocsAndCost[] dims) private void
collectNearMiss
(LeafCollector sidewaysCollector) long
cost()
Same asDocIdSetIterator.cost()
for bulk scorers.private void
doDrillDownAdvanceScoring
(Bits acceptDocs, LeafCollector collector, DrillSidewaysScorer.DocsAndCost[] dims) Used when drill downs are highly constraining vs baseQuery.private void
doQueryFirstScoring
(Bits acceptDocs, LeafCollector collector, DrillSidewaysScorer.DocsAndCost[] dims) Used when base query is highly constraining vs the drilldowns, or when the docs must be scored at once (i.e., like BooleanScorer2, not BooleanScorer).private void
doQueryFirstScoringSingleDim
(Bits acceptDocs, LeafCollector collector, DrillSidewaysScorer.DocsAndCost dim) Query-first scoring specialization when there is only one drill-sideways dimension, which is likely a common scenario.private void
doUnionScoring
(Bits acceptDocs, LeafCollector collector, DrillSidewaysScorer.DocsAndCost[] dims) private void
int
score
(LeafCollector collector, Bits acceptDocs, int min, int maxDoc) Collects matching documents in a range and return an estimation of the next matching document which is on or aftermax
.private void
setScorer
(LeafCollector mainCollector, Scorable scorer) Methods inherited from class org.apache.lucene.search.BulkScorer
score
-
Field Details
-
APPROXIMATION_COMPARATOR
-
TWO_PHASE_COMPARATOR
-
dims
-
baseScorer
-
baseIterator
-
baseApproximation
-
baseTwoPhase
-
context
-
scoreSubDocsAtOnce
final boolean scoreSubDocsAtOnce -
CHUNK
private static final int CHUNK- See Also:
-
MASK
private static final int MASK- See Also:
-
collectDocID
private int collectDocID -
collectScore
private float collectScore
-
-
Constructor Details
-
DrillSidewaysScorer
DrillSidewaysScorer(LeafReaderContext context, Scorer baseScorer, DrillSidewaysScorer.DocsAndCost[] dims, boolean scoreSubDocsAtOnce)
-
-
Method Details
-
cost
public long cost()Description copied from class:BulkScorer
Same asDocIdSetIterator.cost()
for bulk scorers.- Specified by:
cost
in classBulkScorer
-
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 documentmaxDoc
- Score up to, but not including, this doc- Returns:
- an under-estimation of the next matching doc after max
- Throws:
IOException
- >=
-
doQueryFirstScoringSingleDim
private void doQueryFirstScoringSingleDim(Bits acceptDocs, LeafCollector collector, DrillSidewaysScorer.DocsAndCost dim) throws IOException Query-first scoring specialization when there is only one drill-sideways dimension, which is likely a common scenario.- Throws:
IOException
-
doQueryFirstScoring
private void doQueryFirstScoring(Bits acceptDocs, LeafCollector collector, DrillSidewaysScorer.DocsAndCost[] dims) throws IOException Used when base query is highly constraining vs the drilldowns, or when the docs must be scored at once (i.e., like BooleanScorer2, not BooleanScorer).- Throws:
IOException
-
advanceIfBehind
- Throws:
IOException
-
doDrillDownAdvanceScoring
private void doDrillDownAdvanceScoring(Bits acceptDocs, LeafCollector collector, DrillSidewaysScorer.DocsAndCost[] dims) throws IOException Used when drill downs are highly constraining vs baseQuery.- Throws:
IOException
-
doUnionScoring
private void doUnionScoring(Bits acceptDocs, LeafCollector collector, DrillSidewaysScorer.DocsAndCost[] dims) throws IOException - Throws:
IOException
-
collectHit
private void collectHit(LeafCollector collector, DrillSidewaysScorer.DocsAndCost[] dims) throws IOException - Throws:
IOException
-
collectHit
private void collectHit(LeafCollector collector, DrillSidewaysScorer.DocsAndCost dim) throws IOException - Throws:
IOException
-
collectHit
private void collectHit(LeafCollector collector, List<DrillSidewaysScorer.DocsAndCost> dims) throws IOException - Throws:
IOException
-
collectNearMiss
- Throws:
IOException
-
finish
- Throws:
IOException
-
setScorer
- Throws:
IOException
-