Package org.apache.lucene.expressions
Class ExpressionValueSource
- java.lang.Object
-
- org.apache.lucene.search.DoubleValuesSource
-
- org.apache.lucene.expressions.ExpressionValueSource
-
- All Implemented Interfaces:
SegmentCacheable
- Direct Known Subclasses:
CachingExpressionValueSource
class ExpressionValueSource extends DoubleValuesSource
-
-
Field Summary
Fields Modifier and Type Field Description (package private) Expressionexpression(package private) booleanneedsScores(package private) DoubleValuesSource[]variables-
Fields inherited from class org.apache.lucene.search.DoubleValuesSource
SCORES
-
-
Constructor Summary
Constructors Constructor Description ExpressionValueSource(Bindings bindings, Expression expression)ExpressionValueSource(DoubleValuesSource[] variables, Expression expression, boolean needsScores)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)Explanationexplain(LeafReaderContext ctx, int docId, Explanation scoreExplanation)An explanation of the value for the named document.DoubleValuesgetValues(LeafReaderContext readerContext, DoubleValues scores)Returns aDoubleValuesinstance for the passed-in LeafReaderContext and scores If scores are not needed to calculate the values (iereturns false, callers may safely passnullfor thescoresparameter.inthashCode()booleanisCacheable(LeafReaderContext ctx)booleanneedsScores()Return true if document scores are needed to calculate valuesDoubleValuesSourcerewrite(IndexSearcher searcher)Return a DoubleValuesSource specialised for the given IndexSearcher Implementations should assume that this will only be called once.java.lang.StringtoString()(package private) static DoubleValueszeroWhenUnpositioned(DoubleValues in)-
Methods inherited from class org.apache.lucene.search.DoubleValuesSource
constant, fromDoubleField, fromField, fromFloatField, fromIntField, fromLongField, fromQuery, fromScorer, getSortField, toLongValuesSource
-
-
-
-
Field Detail
-
variables
final DoubleValuesSource[] variables
-
expression
final Expression expression
-
needsScores
final boolean needsScores
-
-
Constructor Detail
-
ExpressionValueSource
ExpressionValueSource(Bindings bindings, Expression expression)
-
ExpressionValueSource
ExpressionValueSource(DoubleValuesSource[] variables, Expression expression, boolean needsScores)
-
-
Method Detail
-
getValues
public DoubleValues getValues(LeafReaderContext readerContext, DoubleValues scores) throws java.io.IOException
Description copied from class:DoubleValuesSourceReturns aDoubleValuesinstance for the passed-in LeafReaderContext and scores If scores are not needed to calculate the values (iereturns false, callers may safely passnullfor thescoresparameter.- Specified by:
getValuesin classDoubleValuesSource- Throws:
java.io.IOException
-
zeroWhenUnpositioned
static DoubleValues zeroWhenUnpositioned(DoubleValues in)
-
toString
public java.lang.String toString()
- Specified by:
toStringin classDoubleValuesSource
-
hashCode
public int hashCode()
- Specified by:
hashCodein classDoubleValuesSource
-
equals
public boolean equals(java.lang.Object obj)
- Specified by:
equalsin classDoubleValuesSource
-
needsScores
public boolean needsScores()
Description copied from class:DoubleValuesSourceReturn true if document scores are needed to calculate values- Specified by:
needsScoresin classDoubleValuesSource
-
isCacheable
public boolean isCacheable(LeafReaderContext ctx)
- Returns:
trueif the object can be cached against a given leaf
-
explain
public Explanation explain(LeafReaderContext ctx, int docId, Explanation scoreExplanation) throws java.io.IOException
Description copied from class:DoubleValuesSourceAn explanation of the value for the named document.- Overrides:
explainin classDoubleValuesSource- Parameters:
ctx- the readers context to create theExplanationfor.docId- the document's id relative to the given context's reader- Returns:
- an Explanation for the value
- Throws:
java.io.IOException- if anIOExceptionoccurs
-
rewrite
public DoubleValuesSource rewrite(IndexSearcher searcher) throws java.io.IOException
Description copied from class:DoubleValuesSourceReturn a DoubleValuesSource specialised for the given IndexSearcher Implementations should assume that this will only be called once. IndexReader-independent implementations can just returnthisQueries that use DoubleValuesSource objects should call rewrite() duringQuery.createWeight(IndexSearcher, ScoreMode, float)rather than duringQuery.rewrite(IndexReader)to avoid IndexReader reference leakage. For the same reason, implementations that cache references to the IndexSearcher should return a new object from this method.- Specified by:
rewritein classDoubleValuesSource- Throws:
java.io.IOException
-
-