Class MultiLongValuesSource
- java.lang.Object
-
- org.apache.lucene.facet.MultiLongValuesSource
-
- All Implemented Interfaces:
SegmentCacheable
public abstract class MultiLongValuesSource extends Object implements SegmentCacheable
Base class for producingMultiLongValues
. See alsoLongValuesSource
for a single-valued version.MultiLongValuesSource objects for long and int-valued NumericDocValues/SortedNumericDocValues fields can be obtained by calling
fromLongField(String)
andfromIntField(String)
. This is valid for both multi-valued and single-valued fields.To obtain a MultiLongValuesSource from a float or double-valued NumericDocValues/SortedNumericDocValues field, use
MultiDoubleValuesSource.fromFloatField(String)
orMultiDoubleValuesSource.fromDoubleField(String)
and then callMultiDoubleValuesSource.toMultiLongValuesSource()
.To obtain a MultiLongValuesSource from an existing
LongValuesSource
, seefromSingleValued(LongValuesSource)
. Instances created in this way can be "unwrapped" usingunwrapSingleton(MultiLongValuesSource)
if necessary. Note that scores are never provided to the underlyingLongValuesSource
.LongValuesSource.rewrite(IndexSearcher)
will also never be called. The user should be aware of this if using aLongValuesSource
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 MultiLongValuesSource()
Instantiates a new MultiLongValuesSource
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract boolean
equals(Object o)
static MultiLongValuesSource
fromIntField(String field)
Creates a MultiLongValuesSource that wraps an int-valued fieldstatic MultiLongValuesSource
fromLongField(String field)
Creates a MultiLongValuesSource that wraps a long-valued fieldstatic MultiLongValuesSource
fromSingleValued(LongValuesSource singleValued)
Creates a MultiLongValuesSource that wraps a single-valuedLongValuesSource
abstract MultiLongValues
getValues(LeafReaderContext ctx)
Returns aMultiLongValues
instance for the passed-in LeafReaderContextabstract int
hashCode()
MultiDoubleValuesSource
toMultiDoubleValuesSource()
Convert to a MultiDoubleValuesSource by casting long values to doublesabstract String
toString()
static LongValuesSource
unwrapSingleton(MultiLongValuesSource in)
Returns a single-valued view of theMultiLongValuesSource
if it was previously wrapped withfromSingleValued(LongValuesSource)
, 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 MultiLongValues getValues(LeafReaderContext ctx) throws IOException
Returns aMultiLongValues
instance for the passed-in LeafReaderContext- Throws:
IOException
-
fromLongField
public static MultiLongValuesSource fromLongField(String field)
Creates a MultiLongValuesSource that wraps a long-valued field
-
fromIntField
public static MultiLongValuesSource fromIntField(String field)
Creates a MultiLongValuesSource that wraps an int-valued field
-
fromSingleValued
public static MultiLongValuesSource fromSingleValued(LongValuesSource singleValued)
Creates a MultiLongValuesSource that wraps a single-valuedLongValuesSource
-
unwrapSingleton
public static LongValuesSource unwrapSingleton(MultiLongValuesSource in)
Returns a single-valued view of theMultiLongValuesSource
if it was previously wrapped withfromSingleValued(LongValuesSource)
, or null.
-
toMultiDoubleValuesSource
public final MultiDoubleValuesSource toMultiDoubleValuesSource()
Convert to a MultiDoubleValuesSource by casting long values to doubles
-
-