Class ValueSourceScorer
java.lang.Object
org.apache.lucene.search.Scorable
org.apache.lucene.search.Scorer
org.apache.lucene.queries.function.ValueSourceScorer
Scorer which returns the result of FunctionValues.floatVal(int) as the score for
a document, and which filters out documents that don't match matches(int). This Scorer
has a TwoPhaseIterator. This is similar to FunctionQuery, with an added filter.
Note: If the scores are needed, then the underlying value will probably be fetched/computed twice -- once to filter and next to return the score. If that's non-trivial then consider wrapping it in an implementation that will cache the current value.
- See Also:
- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.lucene.search.Scorable
Scorable.ChildScorable -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedValueSourceScorer(LeafReaderContext readerContext, FunctionValues values) -
Method Summary
Modifier and TypeMethodDescriptionintdocID()floatgetMaxScore(int upTo) iterator()protected floatCost evaluation function which defines the cost of access for the TwoPhaseIterator for this class This method should be overridden for specifying custom cost methods.abstract booleanmatches(int doc) Override to decide if this document matches.floatscore()Methods inherited from class org.apache.lucene.search.Scorer
advanceShallowMethods inherited from class org.apache.lucene.search.Scorable
getChildren, setMinCompetitiveScore, smoothingScore
-
Field Details
-
values
-
-
Constructor Details
-
ValueSourceScorer
-
-
Method Details
-
matches
Override to decide if this document matches. It's called byTwoPhaseIterator.matches().- Throws:
IOException
-
iterator
-
twoPhaseIterator
- Overrides:
twoPhaseIteratorin classScorer
-
docID
public int docID() -
score
- Specified by:
scorein classScorable- Throws:
IOException
-
getMaxScore
- Specified by:
getMaxScorein classScorer- Throws:
IOException
-
matchCost
protected float matchCost()Cost evaluation function which defines the cost of access for the TwoPhaseIterator for this class This method should be overridden for specifying custom cost methods. Used byTwoPhaseIterator.matchCost()for the instance owned by this class- Returns:
- cost of access
- WARNING: This API is experimental and might change in incompatible ways in the next release.
-