Package org.apache.lucene.search
Class DoubleValuesSource.ConstantValuesSource
- java.lang.Object
-
- org.apache.lucene.search.DoubleValuesSource
-
- org.apache.lucene.search.DoubleValuesSource.ConstantValuesSource
-
- All Implemented Interfaces:
SegmentCacheable
- Enclosing class:
- DoubleValuesSource
private static class DoubleValuesSource.ConstantValuesSource extends DoubleValuesSource
-
-
Field Summary
Fields Modifier and Type Field Description private DoubleValues
doubleValues
private double
value
-
Fields inherited from class org.apache.lucene.search.DoubleValuesSource
SCORES
-
-
Constructor Summary
Constructors Modifier Constructor Description private
ConstantValuesSource(double value)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object o)
Explanation
explain(LeafReaderContext ctx, int docId, Explanation scoreExplanation)
An explanation of the value for the named document.DoubleValues
getValues(LeafReaderContext ctx, DoubleValues scores)
Returns aDoubleValues
instance for the passed-in LeafReaderContext and scores If scores are not needed to calculate the values (iereturns false
, callers may safely passnull
for thescores
parameter.int
hashCode()
boolean
isCacheable(LeafReaderContext ctx)
boolean
needsScores()
Return true if document scores are needed to calculate valuesDoubleValuesSource
rewrite(IndexSearcher searcher)
Return a DoubleValuesSource specialised for the given IndexSearcher Implementations should assume that this will only be called once.java.lang.String
toString()
-
Methods inherited from class org.apache.lucene.search.DoubleValuesSource
constant, fromDoubleField, fromField, fromFloatField, fromIntField, fromLongField, fromQuery, fromScorer, getSortField, toLongValuesSource
-
-
-
-
Field Detail
-
doubleValues
private final DoubleValues doubleValues
-
value
private final double value
-
-
Method Detail
-
rewrite
public DoubleValuesSource rewrite(IndexSearcher searcher)
Description copied from class:DoubleValuesSource
Return a DoubleValuesSource specialised for the given IndexSearcher Implementations should assume that this will only be called once. IndexReader-independent implementations can just returnthis
Queries 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:
rewrite
in classDoubleValuesSource
-
getValues
public DoubleValues getValues(LeafReaderContext ctx, DoubleValues scores) throws java.io.IOException
Description copied from class:DoubleValuesSource
Returns aDoubleValues
instance for the passed-in LeafReaderContext and scores If scores are not needed to calculate the values (iereturns false
, callers may safely passnull
for thescores
parameter.- Specified by:
getValues
in classDoubleValuesSource
- Throws:
java.io.IOException
-
needsScores
public boolean needsScores()
Description copied from class:DoubleValuesSource
Return true if document scores are needed to calculate values- Specified by:
needsScores
in classDoubleValuesSource
-
isCacheable
public boolean isCacheable(LeafReaderContext ctx)
- Returns:
true
if the object can be cached against a given leaf
-
explain
public Explanation explain(LeafReaderContext ctx, int docId, Explanation scoreExplanation)
Description copied from class:DoubleValuesSource
An explanation of the value for the named document.- Overrides:
explain
in classDoubleValuesSource
- Parameters:
ctx
- the readers context to create theExplanation
for.docId
- the document's id relative to the given context's reader- Returns:
- an Explanation for the value
-
hashCode
public int hashCode()
- Specified by:
hashCode
in classDoubleValuesSource
-
equals
public boolean equals(java.lang.Object o)
- Specified by:
equals
in classDoubleValuesSource
-
toString
public java.lang.String toString()
- Specified by:
toString
in classDoubleValuesSource
-
-