Package org.apache.lucene.search
Class ConstantScoreScorerSupplier
java.lang.Object
org.apache.lucene.search.ScorerSupplier
org.apache.lucene.search.ConstantScoreScorerSupplier
Specialization of
ScorerSupplier
for queries that produce constant scores.- NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
ConstantScoreScorerSupplier
(float score, ScoreMode scoreMode, int maxDoc) Constructor, invoked by sub-classes. -
Method Summary
Modifier and TypeMethodDescriptionfinal BulkScorer
Optional method: Get a scorer that is optimized for bulk-scoring.static ConstantScoreScorerSupplier
fromIterator
(DocIdSetIterator iterator, float score, ScoreMode scoreMode, int maxDoc) Create aConstantScoreScorerSupplier
for the given iterator.final Scorer
get
(long leadCost) Get theScorer
.abstract DocIdSetIterator
iterator
(long leadCost) Return an iterator given the cost of the leading clause.static ConstantScoreScorerSupplier
Create aConstantScoreScorerSupplier
that matches all docs in [0, maxDoc).Methods inherited from class org.apache.lucene.search.ScorerSupplier
cost, setTopLevelScoringClause
-
Constructor Details
-
ConstantScoreScorerSupplier
Constructor, invoked by sub-classes.
-
-
Method Details
-
matchAll
Create aConstantScoreScorerSupplier
that matches all docs in [0, maxDoc). -
fromIterator
public static ConstantScoreScorerSupplier fromIterator(DocIdSetIterator iterator, float score, ScoreMode scoreMode, int maxDoc) Create aConstantScoreScorerSupplier
for the given iterator. -
iterator
Return an iterator given the cost of the leading clause.- Throws:
IOException
-
get
Description copied from class:ScorerSupplier
Get theScorer
. This may not returnnull
and must be called at most once.- Specified by:
get
in classScorerSupplier
- 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 aScorer
that has good iteration capabilities.- Throws:
IOException
-
bulkScorer
Description copied from class:ScorerSupplier
Optional method: Get a scorer that is optimized for bulk-scoring. The default implementation iterates matches from theScorer
but some queries can have more efficient approaches for matching all hits.- Overrides:
bulkScorer
in classScorerSupplier
- Throws:
IOException
-