Class ValueSource
java.lang.Object
org.apache.lucene.queries.function.ValueSource
- Direct Known Subclasses:
BoolFunction,ByteKnnVectorFieldSource,ConstKnnByteVectorValueSource,ConstKnnFloatValueSource,ConstNumberSource,DocFreqValueSource,DualFloatFunction,FieldCacheSource,FloatKnnVectorFieldSource,LinearFloatFunction,LiteralValueSource,MaxDocValueSource,MultiFloatFunction,MultiFunction,MultiValueSource,NormValueSource,NumDocsValueSource,QueryValueSource,RangeMapFloatFunction,ReciprocalFloatFunction,ScaleFloatFunction,SingleFunction,SumTotalTermFreqValueSource,TotalTermFreqValueSource,VectorSimilarityFunction
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionExpose this ValueSource as a DoubleValuesSourceExpose this ValueSource as a LongValuesSourcevoidcreateWeight(Map<Object, Object> context, IndexSearcher searcher) Implementations should propagate createWeight to sub-ValueSources which can optionally store weight info in the context.abstract Stringdescription of field, used in explain()abstract booleanstatic ValueSourcegetSortField(boolean reverse) EXPERIMENTAL: This method is subject to change.abstract FunctionValuesgetValues(Map<Object, Object> context, LeafReaderContext readerContext) Gets the values for this reader and the context that was previously passed to createWeight().abstract inthashCode()newContext(IndexSearcher searcher) Returns a new non-threadsafe context map.toString()
-
Constructor Details
-
ValueSource
public ValueSource()
-
-
Method Details
-
getValues
public abstract FunctionValues getValues(Map<Object, Object> context, LeafReaderContext readerContext) throws IOExceptionGets the values for this reader and the context that was previously passed to createWeight(). The values must be consumed in a forward docID manner, and you must call this method again to iterate through the values again.- Throws:
IOException
-
equals
-
hashCode
public abstract int hashCode() -
description
description of field, used in explain() -
toString
-
createWeight
Implementations should propagate createWeight to sub-ValueSources which can optionally store weight info in the context. The context object will be passed to getValues() where this info can be retrieved.- Throws:
IOException
-
newContext
Returns a new non-threadsafe context map. -
asLongValuesSource
Expose this ValueSource as a LongValuesSource -
asDoubleValuesSource
Expose this ValueSource as a DoubleValuesSource -
fromDoubleValuesSource
-
getSortField
EXPERIMENTAL: This method is subject to change.Get the SortField for this ValueSource. Uses the
getValues(java.util.Map, org.apache.lucene.index.LeafReaderContext)to populate the SortField.- Parameters:
reverse- true if this is a reverse sort.- Returns:
- The
SortFieldfor the ValueSource
-