Class MultiDoubleValuesSource
- java.lang.Object
-
- org.apache.lucene.facet.MultiDoubleValuesSource
-
- All Implemented Interfaces:
SegmentCacheable
public abstract class MultiDoubleValuesSource extends Object implements SegmentCacheable
Base class for producingMultiDoubleValues. See alsoDoubleValuesSourcefor a single-valued version.MultiDoubleValuesSource objects for NumericDocValues/SortedNumericDocValues fields can be obtained by calling
fromFloatField(String),fromDoubleField(String),fromIntField(String), orfromLongField(String). If custom long-to-double logic is required,fromField(String, LongToDoubleFunction)can be used. This is valid for both multi-valued and single-valued fields.To obtain a MultiDoubleValuesSource from an existing
DoubleValuesSource, seefromSingleValued(DoubleValuesSource). Instances created in this way can be "unwrapped" usingunwrapSingleton(MultiDoubleValuesSource)if necessary. Note that scores are never provided to the underlyingDoubleValuesSource.DoubleValuesSource.rewrite(IndexSearcher)will also never be called. The user should be aware of this if using aDoubleValuesSourcethat relies on rewriting or scores. The faceting use-cases don't call rewrite or provide scores, which is why this simplification was made.Currently meant only for use within the faceting module. Could be further generalized and made available for more use-cases outside faceting if there is a desire to do so.
- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
-
Constructor Summary
Constructors Constructor Description MultiDoubleValuesSource()Instantiates a new MultiDoubleValuesSource
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract booleanequals(Object o)static MultiDoubleValuesSourcefromDoubleField(String field)Creates a MultiDoubleValuesSource that wraps a double-valued fieldstatic MultiDoubleValuesSourcefromField(String field, LongToDoubleFunction decoder)Creates a MultiDoubleValuesSource that wraps a generic NumericDocValues/SortedNumericDocValues field.static MultiDoubleValuesSourcefromFloatField(String field)Creates a MultiDoubleValuesSource that wraps a float-valued fieldstatic MultiDoubleValuesSourcefromIntField(String field)Creates a MultiDoubleValuesSource that wraps an int-valued fieldstatic MultiDoubleValuesSourcefromLongField(String field)Creates a MultiDoubleValuesSource that wraps a long-valued fieldstatic MultiDoubleValuesSourcefromSingleValued(DoubleValuesSource singleValued)Creates a MultiDoubleValuesSource that wraps a single-valuedDoubleValuesSourceabstract MultiDoubleValuesgetValues(LeafReaderContext ctx)Returns aMultiDoubleValuesinstance for the passed-in LeafReaderContextabstract inthashCode()MultiLongValuesSourcetoMultiLongValuesSource()Convert to a MultiLongValuesSource by casting the double values to longsMultiLongValuesSourcetoSortableMultiLongValuesSource()Convert to aMultiLongValuesSourceusingNumericUtils.doubleToSortableLong(double)abstract StringtoString()static DoubleValuesSourceunwrapSingleton(MultiDoubleValuesSource in)Returns a single-valued view of theMultiDoubleValuesSourceif it was previously wrapped withfromSingleValued(DoubleValuesSource), or null.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.lucene.search.SegmentCacheable
isCacheable
-
-
-
-
Method Detail
-
getValues
public abstract MultiDoubleValues getValues(LeafReaderContext ctx) throws IOException
Returns aMultiDoubleValuesinstance for the passed-in LeafReaderContext- Throws:
IOException
-
fromField
public static MultiDoubleValuesSource fromField(String field, LongToDoubleFunction decoder)
Creates a MultiDoubleValuesSource that wraps a generic NumericDocValues/SortedNumericDocValues field. Uses the long-to-double decoding logic specified indecoderfor converting the stored value to a double.
-
fromDoubleField
public static MultiDoubleValuesSource fromDoubleField(String field)
Creates a MultiDoubleValuesSource that wraps a double-valued field
-
fromFloatField
public static MultiDoubleValuesSource fromFloatField(String field)
Creates a MultiDoubleValuesSource that wraps a float-valued field
-
fromLongField
public static MultiDoubleValuesSource fromLongField(String field)
Creates a MultiDoubleValuesSource that wraps a long-valued field
-
fromIntField
public static MultiDoubleValuesSource fromIntField(String field)
Creates a MultiDoubleValuesSource that wraps an int-valued field
-
fromSingleValued
public static MultiDoubleValuesSource fromSingleValued(DoubleValuesSource singleValued)
Creates a MultiDoubleValuesSource that wraps a single-valuedDoubleValuesSource
-
unwrapSingleton
public static DoubleValuesSource unwrapSingleton(MultiDoubleValuesSource in)
Returns a single-valued view of theMultiDoubleValuesSourceif it was previously wrapped withfromSingleValued(DoubleValuesSource), or null.
-
toMultiLongValuesSource
public final MultiLongValuesSource toMultiLongValuesSource()
Convert to a MultiLongValuesSource by casting the double values to longs
-
toSortableMultiLongValuesSource
public final MultiLongValuesSource toSortableMultiLongValuesSource()
Convert to aMultiLongValuesSourceusingNumericUtils.doubleToSortableLong(double)
-
-