class FeatureDoubleValuesSource extends DoubleValuesSource
DoubleValuesSource
instance which can be used to read the values of a feature from a
FeatureField
for documents.Modifier and Type | Class and Description |
---|---|
(package private) static class |
FeatureDoubleValuesSource.FeatureDoubleValues |
Modifier and Type | Field and Description |
---|---|
private BytesRef |
featureName |
private java.lang.String |
field |
SCORES
Constructor and Description |
---|
FeatureDoubleValuesSource(java.lang.String field,
java.lang.String featureName)
Creates a
DoubleValuesSource instance which can be used to read the values of a feature from the a
FeatureField for documents. |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
DoubleValues |
getValues(LeafReaderContext ctx,
DoubleValues scores)
Returns a
DoubleValues instance for the passed-in LeafReaderContext and scores
If scores are not needed to calculate the values (ie returns false , callers
may safely pass null for the scores parameter. |
int |
hashCode() |
boolean |
isCacheable(LeafReaderContext ctx) |
boolean |
needsScores()
Return true if document scores are needed to calculate values
|
DoubleValuesSource |
rewrite(IndexSearcher reader)
Return a DoubleValuesSource specialised for the given IndexSearcher
Implementations should assume that this will only be called once.
|
java.lang.String |
toString() |
constant, explain, fromDoubleField, fromField, fromFloatField, fromIntField, fromLongField, fromQuery, fromScorer, getSortField, toLongValuesSource
private final BytesRef featureName
private final java.lang.String field
public FeatureDoubleValuesSource(java.lang.String field, java.lang.String featureName)
DoubleValuesSource
instance which can be used to read the values of a feature from the a
FeatureField
for documents.field
- field name. Must not be null.featureName
- feature name. Must not be null.java.lang.NullPointerException
- if field
or featureName
is null.public boolean isCacheable(LeafReaderContext ctx)
true
if the object can be cached against a given leafpublic DoubleValues getValues(LeafReaderContext ctx, DoubleValues scores) throws java.io.IOException
DoubleValuesSource
DoubleValues
instance for the passed-in LeafReaderContext and scores
If scores are not needed to calculate the values (ie returns false
, callers
may safely pass null
for the scores
parameter.getValues
in class DoubleValuesSource
java.io.IOException
public boolean needsScores()
DoubleValuesSource
needsScores
in class DoubleValuesSource
public DoubleValuesSource rewrite(IndexSearcher reader) throws java.io.IOException
DoubleValuesSource
this
Queries that use DoubleValuesSource objects should call rewrite() during
Query.createWeight(IndexSearcher, ScoreMode, float)
rather than during
Query.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.rewrite
in class DoubleValuesSource
java.io.IOException
public int hashCode()
hashCode
in class DoubleValuesSource
public boolean equals(java.lang.Object obj)
equals
in class DoubleValuesSource
public java.lang.String toString()
toString
in class DoubleValuesSource