java.lang.Object
org.apache.lucene.search.DoubleValuesSource
org.apache.lucene.document.FeatureDoubleValuesSource
- All Implemented Interfaces:
SegmentCacheable
A
DoubleValuesSource
instance which can be used to read the values of a feature from a
FeatureField
for documents.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static class
-
Field Summary
FieldsFields inherited from class org.apache.lucene.search.DoubleValuesSource
SCORES
-
Constructor Summary
ConstructorsConstructorDescriptionFeatureDoubleValuesSource
(String field, String featureName) Creates aDoubleValuesSource
instance which can be used to read the values of a feature from the aFeatureField
for documents. -
Method Summary
Modifier and TypeMethodDescriptionboolean
getValues
(LeafReaderContext ctx, DoubleValues scores) Returns aDoubleValues
instance for the passed-in LeafReaderContext and scoresint
hashCode()
boolean
boolean
Return true if document scores are needed to calculate valuesrewrite
(IndexSearcher reader) Return a DoubleValuesSource specialised for the given IndexSearchertoString()
Methods inherited from class org.apache.lucene.search.DoubleValuesSource
constant, explain, fromDoubleField, fromField, fromFloatField, fromIntField, fromLongField, fromQuery, fromScorer, getSortField, toLongValuesSource
-
Field Details
-
featureName
-
field
-
-
Constructor Details
-
FeatureDoubleValuesSource
Creates aDoubleValuesSource
instance which can be used to read the values of a feature from the aFeatureField
for documents.- Parameters:
field
- field name. Must not be null.featureName
- feature name. Must not be null.- Throws:
NullPointerException
- iffield
orfeatureName
is null.
-
-
Method Details
-
isCacheable
- Returns:
true
if the object can be cached against a given leaf
-
getValues
Description copied from class:DoubleValuesSource
Returns aDoubleValues
instance for the passed-in LeafReaderContext and scoresIf scores are not needed to calculate the values (ie
returns false
, callers may safely passnull
for thescores
parameter.- Specified by:
getValues
in classDoubleValuesSource
- Throws:
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
-
rewrite
Description copied from class:DoubleValuesSource
Return a DoubleValuesSource specialised for the given IndexSearcherImplementations should assume that this will only be called once. IndexReader-independent implementations can just return
this
Queries that use DoubleValuesSource objects should call rewrite() during
Query.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
- Throws:
IOException
-
hashCode
public int hashCode()- Specified by:
hashCode
in classDoubleValuesSource
-
equals
- Specified by:
equals
in classDoubleValuesSource
-
toString
- Specified by:
toString
in classDoubleValuesSource
-