Package org.apache.lucene.search
Class ScorerSupplier
java.lang.Object
org.apache.lucene.search.ScorerSupplier
- Direct Known Subclasses:
ConstantScoreScorerSupplier,Weight.DefaultScorerSupplier
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionOptional method: Get a scorer that is optimized for bulk-scoring.abstract longcost()abstract Scorerget(long leadCost) Get theScorer.voidInform thisScorerSupplierthat its returned scorers produce scores that get passed to the collector, as opposed to partial scores that then need to get combined (e.g.
-
Constructor Details
-
ScorerSupplier
public ScorerSupplier()
-
-
Method Details
-
get
Get theScorer. This may not returnnulland must be called at most once.- Parameters:
leadCost- Cost of the scorer that will be used in order to lead iteration. This can be interpreted as an upper bound of the number of times thatDocIdSetIterator.nextDoc(),DocIdSetIterator.advance(int)andTwoPhaseIterator.matches()will be called. Under doubt, passLong.MAX_VALUE, which will produce aScorerthat has good iteration capabilities.- Throws:
IOException
-
bulkScorer
Optional method: Get a scorer that is optimized for bulk-scoring. The default implementation iterates matches from theScorerbut some queries can have more efficient approaches for matching all hits.- Throws:
IOException
-
cost
public abstract long cost()Get an estimate of theScorerthat would be returned byget(long). This may be a costly operation, so it should only be called if necessary.- See Also:
-
setTopLevelScoringClause
Inform thisScorerSupplierthat its returned scorers produce scores that get passed to the collector, as opposed to partial scores that then need to get combined (e.g. summed up). Note that this method also gets called if scores are not requested, e.g. because the score mode isScoreMode.COMPLETE_NO_SCORES, so implementations should look at both the score mode and this boolean to know whether to prepare for reacting toScorable.setMinCompetitiveScore(float)calls.- Throws:
IOException
-