protected static class Weight.DefaultBulkScorer extends BulkScorer
Modifier and Type | Field and Description |
---|---|
private DocIdSetIterator |
iterator |
private Scorer |
scorer |
private TwoPhaseIterator |
twoPhase |
Constructor and Description |
---|
DefaultBulkScorer(Scorer scorer)
Sole constructor.
|
Modifier and Type | Method and Description |
---|---|
long |
cost()
Same as
DocIdSetIterator.cost() for bulk scorers. |
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 after
max . |
(package private) static void |
scoreAll(LeafCollector collector,
DocIdSetIterator iterator,
TwoPhaseIterator twoPhase,
Bits acceptDocs)
Specialized method to bulk-score all hits; we
separate this from
scoreRange(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 int |
scoreRange(LeafCollector collector,
DocIdSetIterator iterator,
TwoPhaseIterator twoPhase,
Bits acceptDocs,
int currentDoc,
int end)
Specialized method to bulk-score a range of hits; we
separate this from
scoreAll(org.apache.lucene.search.LeafCollector, org.apache.lucene.search.DocIdSetIterator, org.apache.lucene.search.TwoPhaseIterator, org.apache.lucene.util.Bits) to help out
hotspot. |
score
private final Scorer scorer
private final DocIdSetIterator iterator
private final TwoPhaseIterator twoPhase
public DefaultBulkScorer(Scorer scorer)
public long cost()
BulkScorer
DocIdSetIterator.cost()
for bulk scorers.cost
in class BulkScorer
public int score(LeafCollector collector, Bits acceptDocs, int min, int max) throws java.io.IOException
BulkScorer
max
.
The return value must be:
max
,DocIdSetIterator.NO_MORE_DOCS
if there are no more matches,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; }
score
in class BulkScorer
collector
- The collector to which all matching documents are passed.acceptDocs
- Bits
that represents the allowed documents to match, or
null
if they are all allowed to match.min
- Score starting at, including, this documentmax
- Score up to, but not including, this docjava.io.IOException
static int scoreRange(LeafCollector collector, DocIdSetIterator iterator, TwoPhaseIterator twoPhase, Bits acceptDocs, int currentDoc, int end) throws java.io.IOException
scoreAll(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-5487java.io.IOException
static void scoreAll(LeafCollector collector, DocIdSetIterator iterator, TwoPhaseIterator twoPhase, Bits acceptDocs) throws java.io.IOException
scoreRange(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-5487java.io.IOException