Package org.apache.lucene.document
Class FeatureDoubleValuesSource
- java.lang.Object
-
- org.apache.lucene.search.DoubleValuesSource
-
- org.apache.lucene.document.FeatureDoubleValuesSource
-
- All Implemented Interfaces:
SegmentCacheable
class FeatureDoubleValuesSource extends DoubleValuesSource
ADoubleValuesSourceinstance which can be used to read the values of a feature from aFeatureFieldfor documents.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classFeatureDoubleValuesSource.FeatureDoubleValues
-
Field Summary
Fields Modifier and Type Field Description private BytesReffeatureNameprivate java.lang.Stringfield-
Fields inherited from class org.apache.lucene.search.DoubleValuesSource
SCORES
-
-
Constructor Summary
Constructors Constructor Description FeatureDoubleValuesSource(java.lang.String field, java.lang.String featureName)Creates aDoubleValuesSourceinstance which can be used to read the values of a feature from the aFeatureFieldfor documents.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)DoubleValuesgetValues(LeafReaderContext ctx, 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 reader)Return a DoubleValuesSource specialised for the given IndexSearcher Implementations should assume that this will only be called once.java.lang.StringtoString()-
Methods inherited from class org.apache.lucene.search.DoubleValuesSource
constant, explain, fromDoubleField, fromField, fromFloatField, fromIntField, fromLongField, fromQuery, fromScorer, getSortField, toLongValuesSource
-
-
-
-
Field Detail
-
featureName
private final BytesRef featureName
-
field
private final java.lang.String field
-
-
Constructor Detail
-
FeatureDoubleValuesSource
public FeatureDoubleValuesSource(java.lang.String field, java.lang.String featureName)Creates aDoubleValuesSourceinstance which can be used to read the values of a feature from the aFeatureFieldfor documents.- Parameters:
field- field name. Must not be null.featureName- feature name. Must not be null.- Throws:
java.lang.NullPointerException- iffieldorfeatureNameis null.
-
-
Method Detail
-
isCacheable
public boolean isCacheable(LeafReaderContext ctx)
- Returns:
trueif the object can be cached against a given leaf
-
getValues
public DoubleValues getValues(LeafReaderContext ctx, 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
-
needsScores
public boolean needsScores()
Description copied from class:DoubleValuesSourceReturn true if document scores are needed to calculate values- Specified by:
needsScoresin classDoubleValuesSource
-
rewrite
public DoubleValuesSource rewrite(IndexSearcher reader) 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
-
hashCode
public int hashCode()
- Specified by:
hashCodein classDoubleValuesSource
-
equals
public boolean equals(java.lang.Object obj)
- Specified by:
equalsin classDoubleValuesSource
-
toString
public java.lang.String toString()
- Specified by:
toStringin classDoubleValuesSource
-
-