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 alsoDoubleValuesSource
for 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 aDoubleValuesSource
that 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 boolean
equals(Object o)
static MultiDoubleValuesSource
fromDoubleField(String field)
Creates a MultiDoubleValuesSource that wraps a double-valued fieldstatic MultiDoubleValuesSource
fromField(String field, LongToDoubleFunction decoder)
Creates a MultiDoubleValuesSource that wraps a generic NumericDocValues/SortedNumericDocValues field.static MultiDoubleValuesSource
fromFloatField(String field)
Creates a MultiDoubleValuesSource that wraps a float-valued fieldstatic MultiDoubleValuesSource
fromIntField(String field)
Creates a MultiDoubleValuesSource that wraps an int-valued fieldstatic MultiDoubleValuesSource
fromLongField(String field)
Creates a MultiDoubleValuesSource that wraps a long-valued fieldstatic MultiDoubleValuesSource
fromSingleValued(DoubleValuesSource singleValued)
Creates a MultiDoubleValuesSource that wraps a single-valuedDoubleValuesSource
abstract MultiDoubleValues
getValues(LeafReaderContext ctx)
Returns aMultiDoubleValues
instance for the passed-in LeafReaderContextabstract int
hashCode()
MultiLongValuesSource
toMultiLongValuesSource()
Convert to a MultiLongValuesSource by casting the double values to longsMultiLongValuesSource
toSortableMultiLongValuesSource()
Convert to aMultiLongValuesSource
usingNumericUtils.doubleToSortableLong(double)
abstract String
toString()
static DoubleValuesSource
unwrapSingleton(MultiDoubleValuesSource in)
Returns a single-valued view of theMultiDoubleValuesSource
if 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 aMultiDoubleValues
instance 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 indecoder
for 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 theMultiDoubleValuesSource
if 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 aMultiLongValuesSource
usingNumericUtils.doubleToSortableLong(double)
-
-