java.lang.Object
org.apache.lucene.search.BulkScorer
org.apache.lucene.facet.DrillSidewaysScorer
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static classprivate final class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Comparator<DrillSidewaysScorer.DocsAndCost> private final DocIdSetIteratorprivate final DocIdSetIteratorprivate final Scorerprivate final TwoPhaseIteratorprivate static final intprivate intprivate floatprivate final LeafReaderContextprivate final DrillSidewaysScorer.DocsAndCost[]private static final int(package private) final booleanprivate static final Comparator<DrillSidewaysScorer.DocsAndCost> -
Constructor Summary
ConstructorsConstructorDescriptionDrillSidewaysScorer(LeafReaderContext context, Scorer baseScorer, DrillSidewaysScorer.DocsAndCost[] dims, boolean scoreSubDocsAtOnce) -
Method Summary
Modifier and TypeMethodDescriptionprivate static intadvanceIfBehind(int docID, DocIdSetIterator iterator) private voidcollectHit(LeafCollector collector, List<DrillSidewaysScorer.DocsAndCost> dims) private voidcollectHit(LeafCollector collector, DrillSidewaysScorer.DocsAndCost dim) private voidcollectHit(LeafCollector collector, DrillSidewaysScorer.DocsAndCost[] dims) private voidcollectNearMiss(LeafCollector sidewaysCollector) longcost()Same asDocIdSetIterator.cost()for bulk scorers.private voiddoDrillDownAdvanceScoring(Bits acceptDocs, LeafCollector collector, DrillSidewaysScorer.DocsAndCost[] dims) Used when drill downs are highly constraining vs baseQuery.private voiddoQueryFirstScoring(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 voiddoQueryFirstScoringSingleDim(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 voiddoUnionScoring(Bits acceptDocs, LeafCollector collector, DrillSidewaysScorer.DocsAndCost[] dims) private voidintscore(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 voidsetScorer(LeafCollector mainCollector, Scorable scorer)
-
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:BulkScorerSame asDocIdSetIterator.cost()for bulk scorers.- Specified by:
costin classBulkScorer
-
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 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
-