MultiLongValuesSource (Lucene 10.5.0 facet API)
Description: declaration: package: org.apache.lucene.facet, class: MultiLongValuesSource

Package org.apache.lucene.facet

# 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 producing `MultiLongValues`. See also `LongValuesSource` for a single-valued version.

MultiLongValuesSource objects for long and int-valued NumericDocValues/SortedNumericDocValues fields can be obtained by calling `fromLongField(String)` and `fromIntField(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)` or `MultiDoubleValuesSource.fromDoubleField(String)` and then call `MultiDoubleValuesSource.toMultiLongValuesSource()`.

To obtain a MultiLongValuesSource from an existing `LongValuesSource`, see `fromSingleValued(LongValuesSource)`. Instances created in this way can be "unwrapped" using `unwrapSingleton(MultiLongValuesSource)` if necessary. Note that scores are never provided to the underlying `LongValuesSource`. `LongValuesSource.rewrite(IndexSearcher)` will also never be called. The user should be aware of this if using a `LongValuesSource` 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

  Modifier and Type
  Method
  Description
  `abstract boolean`
  `equals(Object o)`
  `static MultiLongValuesSource`
  `fromIntField(String field)`
  Creates a MultiLongValuesSource that wraps an int-valued field
  `static MultiLongValuesSource`
  `fromLongField(String field)`
  Creates a MultiLongValuesSource that wraps a long-valued field
  `static MultiLongValuesSource`
  `fromSingleValued(LongValuesSource singleValued)`
  Creates a MultiLongValuesSource that wraps a single-valued `LongValuesSource`
  `abstract MultiLongValues`
  `getValues(LeafReaderContext ctx)`
  Returns a `MultiLongValues` instance for the passed-in LeafReaderContext
  `abstract int`
  `hashCode()`
  `final MultiDoubleValuesSource`
  `toMultiDoubleValuesSource()`
  Convert to a MultiDoubleValuesSource by casting long values to doubles
  `abstract String`
  `toString()`
  `static LongValuesSource`
  `unwrapSingleton(MultiLongValuesSource in)`
  Returns a single-valued view of the `MultiLongValuesSource` if it was previously wrapped with `fromSingleValued(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`

- ## Constructor Details

  - ### MultiLongValuesSource

    public MultiLongValuesSource()
    Instantiates a new MultiLongValuesSource

- ## Method Details

  - ### getValues

    public abstract MultiLongValues getValues(LeafReaderContext ctx) throws IOException
    Returns a `MultiLongValues` instance for the passed-in LeafReaderContext
    Throws:
      `IOException`

  - ### hashCode

    public abstract int hashCode()
    Overrides:
      `hashCode` in class `Object`

  - ### equals

    public abstract boolean equals(Object o)
    Overrides:
      `equals` in class `Object`

  - ### toString

    public abstract String toString()
    Overrides:
      `toString` in class `Object`

  - ### 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-valued `LongValuesSource`

  - ### unwrapSingleton

    public static LongValuesSource unwrapSingleton(MultiLongValuesSource in)
    Returns a single-valued view of the `MultiLongValuesSource` if it was previously wrapped with `fromSingleValued(LongValuesSource)`, or null.

  - ### toMultiDoubleValuesSource

    public final MultiDoubleValuesSource toMultiDoubleValuesSource()
    Convert to a MultiDoubleValuesSource by casting long values to doubles