Class ValueSource
- java.lang.Object
-
- org.apache.lucene.queries.function.ValueSource
-
- Direct Known Subclasses:
BoolFunction
,ConstNumberSource
,DocFreqValueSource
,DualFloatFunction
,FieldCacheSource
,LinearFloatFunction
,LiteralValueSource
,MaxDocValueSource
,MultiFloatFunction
,MultiFunction
,MultiValueSource
,NormValueSource
,NumDocsValueSource
,QueryValueSource
,RangeMapFloatFunction
,ReciprocalFloatFunction
,ScaleFloatFunction
,SingleFunction
,SumTotalTermFreqValueSource
,TotalTermFreqValueSource
,ValueSource.FromDoubleValuesSource
public abstract class ValueSource extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
ValueSource.FromDoubleValuesSource
private static class
ValueSource.ScorableView
(package private) class
ValueSource.ValueSourceComparator
Implement aFieldComparator
that works off of theFunctionValues
for a ValueSource instead of the normal Lucene FieldComparator that works off of a FieldCache.(package private) class
ValueSource.ValueSourceComparatorSource
(package private) class
ValueSource.ValueSourceSortField
(package private) static class
ValueSource.WrappedDoubleValuesSource
private static class
ValueSource.WrappedLongValuesSource
-
Constructor Summary
Constructors Constructor Description ValueSource()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description DoubleValuesSource
asDoubleValuesSource()
Expose this ValueSource as a DoubleValuesSourceLongValuesSource
asLongValuesSource()
Expose this ValueSource as a LongValuesSourcevoid
createWeight(java.util.Map<java.lang.Object,java.lang.Object> context, IndexSearcher searcher)
Implementations should propagate createWeight to sub-ValueSources which can optionally store weight info in the context.abstract java.lang.String
description()
description of field, used in explain()abstract boolean
equals(java.lang.Object o)
static ValueSource
fromDoubleValuesSource(DoubleValuesSource in)
SortField
getSortField(boolean reverse)
EXPERIMENTAL: This method is subject to change.abstract FunctionValues
getValues(java.util.Map<java.lang.Object,java.lang.Object> context, LeafReaderContext readerContext)
Gets the values for this reader and the context that was previously passed to createWeight().abstract int
hashCode()
static java.util.Map<java.lang.Object,java.lang.Object>
newContext(IndexSearcher searcher)
Returns a new non-threadsafe context map.java.lang.String
toString()
-
-
-
Method Detail
-
getValues
public abstract FunctionValues getValues(java.util.Map<java.lang.Object,java.lang.Object> context, LeafReaderContext readerContext) throws java.io.IOException
Gets 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:
java.io.IOException
-
equals
public abstract boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public abstract int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
description
public abstract java.lang.String description()
description of field, used in explain()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
createWeight
public void createWeight(java.util.Map<java.lang.Object,java.lang.Object> context, IndexSearcher searcher) throws java.io.IOException
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:
java.io.IOException
-
newContext
public static java.util.Map<java.lang.Object,java.lang.Object> newContext(IndexSearcher searcher)
Returns a new non-threadsafe context map.
-
asLongValuesSource
public LongValuesSource asLongValuesSource()
Expose this ValueSource as a LongValuesSource
-
asDoubleValuesSource
public DoubleValuesSource asDoubleValuesSource()
Expose this ValueSource as a DoubleValuesSource
-
fromDoubleValuesSource
public static ValueSource fromDoubleValuesSource(DoubleValuesSource in)
-
getSortField
public SortField getSortField(boolean reverse)
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
SortField
for the ValueSource
-
-