public abstract class Scorer extends ScorableExpert: Common scoring functionality for different types of queries.
iterator()over documents matching a query in increasing order of doc Id.
Document scores are computed using a given
NOTE: The values Float.Nan, Float.NEGATIVE_INFINITY and Float.POSITIVE_INFINITY are not valid scores. Certain collectors (eg
TopScoreDocCollector) will not properly collect hits with these scores.
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description
advanceShallow(int target)Advance to the block of documents that contains
targetin order to get scoring information about this block.
getMaxScore(int upTo)Return the maximum score that documents between the last
targetthat this iterator was
shallow-advancedto included and
getWeight()returns parent Weight
DocIdSetIteratorover matching documents.
Methods inherited from class org.apache.lucene.search.Scorable
docID, getChildren, score, setMinCompetitiveScore
protected final Weight weightthe Scorer's parent Weight
protected Scorer(Weight weight)Constructs a Scorer
weight- The scorers
public Weight getWeight()returns parent Weight
- WARNING: This API is experimental and might change in incompatible ways in the next release.
public abstract DocIdSetIterator iterator()Return a
DocIdSetIteratorover matching documents. The returned iterator will either be positioned on
-1if no documents have been scored yet,
DocIdSetIterator.NO_MORE_DOCSif all documents have been scored already, or the last document id that has been scored otherwise. The returned iterator is a view: calling this method several times will return iterators that have the same state.
public TwoPhaseIterator twoPhaseIterator()Optional method: Return a
TwoPhaseIteratorview of this
Scorer. A return value of
nullindicates that two-phase iteration is not supported. Note that the returned
approximationmust advance synchronously with the
iterator(): advancing the approximation must advance the iterator and vice-versa. Implementing this method is typically useful on
Scorers that have a high per-document overhead in order to confirm matches. The default implementation returns
public int advanceShallow(int target) throws IOExceptionAdvance to the block of documents that contains
targetin order to get scoring information about this block. This method is implicitly called by
DocIdSetIterator.nextDoc()on the returned doc ID. Calling this method doesn't modify the current
DocIdSetIterator.docID(). It returns a number that is greater than or equal to all documents contained in the current block, but less than any doc IDS of the next block.
targetmust be >=
Scorable.docID()as well as all targets that have been passed to