Package org.apache.lucene.search
Class Weight.DefaultBulkScorer
- java.lang.Object
-
- org.apache.lucene.search.BulkScorer
-
- org.apache.lucene.search.Weight.DefaultBulkScorer
-
- Enclosing class:
- Weight
protected static class Weight.DefaultBulkScorer extends BulkScorer
Just wraps a Scorer and performs top scoring using it.
-
-
Field Summary
Fields Modifier and Type Field Description private DocIdSetIteratoriteratorprivate Scorerscorerprivate TwoPhaseIteratortwoPhase
-
Constructor Summary
Constructors Constructor Description DefaultBulkScorer(Scorer scorer)Sole constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description longcost()Same asDocIdSetIterator.cost()for bulk scorers.intscore(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.(package private) static voidscoreAll(LeafCollector collector, DocIdSetIterator iterator, TwoPhaseIterator twoPhase, Bits acceptDocs)Specialized method to bulk-score all hits; we separate this fromscoreRange(org.apache.lucene.search.LeafCollector, org.apache.lucene.search.DocIdSetIterator, org.apache.lucene.search.TwoPhaseIterator, org.apache.lucene.util.Bits, int, int)to help out hotspot.(package private) static intscoreRange(LeafCollector collector, DocIdSetIterator iterator, TwoPhaseIterator twoPhase, Bits acceptDocs, int currentDoc, int end)Specialized method to bulk-score a range of hits; we separate this fromscoreAll(org.apache.lucene.search.LeafCollector, org.apache.lucene.search.DocIdSetIterator, org.apache.lucene.search.TwoPhaseIterator, org.apache.lucene.util.Bits)to help out hotspot.-
Methods inherited from class org.apache.lucene.search.BulkScorer
score
-
-
-
-
Field Detail
-
scorer
private final Scorer scorer
-
iterator
private final DocIdSetIterator iterator
-
twoPhase
private final TwoPhaseIterator twoPhase
-
-
Constructor Detail
-
DefaultBulkScorer
public DefaultBulkScorer(Scorer scorer)
Sole constructor.
-
-
Method Detail
-
cost
public long cost()
Description copied from class:BulkScorerSame asDocIdSetIterator.cost()for bulk scorers.- Specified by:
costin classBulkScorer
-
score
public int score(LeafCollector collector, Bits acceptDocs, int min, int max) throws java.io.IOException
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 documentmax- Score up to, but not including, this doc- Returns:
- an under-estimation of the next matching doc after max
- Throws:
java.io.IOException
- >=
-
scoreRange
static int scoreRange(LeafCollector collector, DocIdSetIterator iterator, TwoPhaseIterator twoPhase, Bits acceptDocs, int currentDoc, int end) throws java.io.IOException
Specialized method to bulk-score a range of hits; we separate this fromscoreAll(org.apache.lucene.search.LeafCollector, org.apache.lucene.search.DocIdSetIterator, org.apache.lucene.search.TwoPhaseIterator, org.apache.lucene.util.Bits)to help out hotspot. See LUCENE-5487- Throws:
java.io.IOException
-
scoreAll
static void scoreAll(LeafCollector collector, DocIdSetIterator iterator, TwoPhaseIterator twoPhase, Bits acceptDocs) throws java.io.IOException
Specialized method to bulk-score all hits; we separate this fromscoreRange(org.apache.lucene.search.LeafCollector, org.apache.lucene.search.DocIdSetIterator, org.apache.lucene.search.TwoPhaseIterator, org.apache.lucene.util.Bits, int, int)to help out hotspot. See LUCENE-5487- Throws:
java.io.IOException
-
-