- java.lang.Object
-
- org.apache.lucene.search.ScorerSupplier
-
- org.apache.lucene.search.Boolean2ScorerSupplier
-
final class Boolean2ScorerSupplier extends ScorerSupplier
-
-
Field Summary
Fields Modifier and Type Field Description private long
cost
private int
minShouldMatch
private ScoreMode
scoreMode
private java.util.Map<BooleanClause.Occur,java.util.Collection<ScorerSupplier>>
subs
private boolean
topLevelScoringClause
private Weight
weight
-
Constructor Summary
Constructors Constructor Description Boolean2ScorerSupplier(Weight weight, java.util.Map<BooleanClause.Occur,java.util.Collection<ScorerSupplier>> subs, ScoreMode scoreMode, int minShouldMatch)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private long
computeCost()
long
cost()
Get an estimate of theScorer
that would be returned byScorerSupplier.get(long)
.private Scorer
excl(Scorer main, java.util.Collection<ScorerSupplier> prohibited, long leadCost)
Scorer
get(long leadCost)
Get theScorer
.private Scorer
getInternal(long leadCost)
private Scorer
opt(java.util.Collection<ScorerSupplier> optional, int minShouldMatch, ScoreMode scoreMode, long leadCost, boolean topLevelScoringClause)
private Scorer
req(java.util.Collection<ScorerSupplier> requiredNoScoring, java.util.Collection<ScorerSupplier> requiredScoring, long leadCost, boolean topLevelScoringClause)
Create a new scorer for the given required clauses.void
setTopLevelScoringClause()
Inform thisScorerSupplier
that its returned scorers produce scores that get passed to the collector, as opposed to partial scores that then need to get combined (e.g.
-
-
-
Field Detail
-
weight
private final Weight weight
-
subs
private final java.util.Map<BooleanClause.Occur,java.util.Collection<ScorerSupplier>> subs
-
scoreMode
private final ScoreMode scoreMode
-
minShouldMatch
private final int minShouldMatch
-
cost
private long cost
-
topLevelScoringClause
private boolean topLevelScoringClause
-
-
Constructor Detail
-
Boolean2ScorerSupplier
Boolean2ScorerSupplier(Weight weight, java.util.Map<BooleanClause.Occur,java.util.Collection<ScorerSupplier>> subs, ScoreMode scoreMode, int minShouldMatch)
-
-
Method Detail
-
computeCost
private long computeCost()
-
setTopLevelScoringClause
public void setTopLevelScoringClause() throws java.io.IOException
Description copied from class:ScorerSupplier
Inform thisScorerSupplier
that 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.- Overrides:
setTopLevelScoringClause
in classScorerSupplier
- Throws:
java.io.IOException
-
cost
public long cost()
Description copied from class:ScorerSupplier
Get an estimate of theScorer
that would be returned byScorerSupplier.get(long)
. This may be a costly operation, so it should only be called if necessary.- Specified by:
cost
in classScorerSupplier
- See Also:
DocIdSetIterator.cost()
-
get
public Scorer get(long leadCost) throws java.io.IOException
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:
java.io.IOException
-
getInternal
private Scorer getInternal(long leadCost) throws java.io.IOException
- Throws:
java.io.IOException
-
req
private Scorer req(java.util.Collection<ScorerSupplier> requiredNoScoring, java.util.Collection<ScorerSupplier> requiredScoring, long leadCost, boolean topLevelScoringClause) throws java.io.IOException
Create a new scorer for the given required clauses. Note thatrequiredScoring
is a subset ofrequired
containing required clauses that should participate in scoring.- Throws:
java.io.IOException
-
excl
private Scorer excl(Scorer main, java.util.Collection<ScorerSupplier> prohibited, long leadCost) throws java.io.IOException
- Throws:
java.io.IOException
-
opt
private Scorer opt(java.util.Collection<ScorerSupplier> optional, int minShouldMatch, ScoreMode scoreMode, long leadCost, boolean topLevelScoringClause) throws java.io.IOException
- Throws:
java.io.IOException
-
-