LongAggregationsFacetRecorder (Lucene 10.5.1 sandbox API)
Description: declaration: package: org.apache.lucene.sandbox.facet.recorders, class: LongAggregationsFacetRecorder

Package org.apache.lucene.sandbox.facet.recorders

# Class LongAggregationsFacetRecorder

java.lang.Object
org.apache.lucene.sandbox.facet.recorders.LongAggregationsFacetRecorder

All Implemented Interfaces:
  `FacetRecorder`

public final class LongAggregationsFacetRecorder extends Object implements FacetRecorder
`FacetRecorder` that computes multiple long aggregations per facet.

TODO: [premature optimization idea] if instead of one array we keep aggregations in two LongVector (one for MAX aggregation and one for SUM) we can benefit from SIMD?

WARNING: This API is experimental and might change in incompatible ways in the next release.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `LongAggregationsFacetRecorder(LongValuesSource[] longValuesSources, Reducer[] reducers)`
  Constructor.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `contains(int ordinal)`
  Check if any data was recorded for provided facet ordinal.
  `LeafFacetRecorder`
  `getLeafRecorder(LeafReaderContext context)`
  Get leaf recorder.
  `long`
  `getRecordedValue(int ord, int valuesId)`
  Return aggregated value for facet ordinal and aggregation ID, or zero as default.
  `boolean`
  `isEmpty()`
  True if there are no records
  `OrdinalIterator`
  `recordedOrds()`
  Return next collected ordinal, or `OrdinalIterator.NO_MORE_ORDS`
  `void`
  `reduce(FacetCutter facetCutter)`
  Reduce leaf recorder results into this recorder.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### LongAggregationsFacetRecorder

    public LongAggregationsFacetRecorder(LongValuesSource[] longValuesSources, Reducer[] reducers)
    Constructor.

- ## Method Details

  - ### getLeafRecorder

    public LeafFacetRecorder getLeafRecorder(LeafReaderContext context) throws IOException
    Description copied from interface: `FacetRecorder`
    Get leaf recorder.
    Specified by:
      `getLeafRecorder` in interface `FacetRecorder`
    Throws:
      `IOException`

  - ### recordedOrds

    public OrdinalIterator recordedOrds()
    Description copied from interface: `FacetRecorder`
    Return next collected ordinal, or `OrdinalIterator.NO_MORE_ORDS`
    Specified by:
      `recordedOrds` in interface `FacetRecorder`

  - ### isEmpty

    public boolean isEmpty()
    Description copied from interface: `FacetRecorder`
    True if there are no records
    Specified by:
      `isEmpty` in interface `FacetRecorder`

  - ### reduce

    public void reduce(FacetCutter facetCutter) throws IOException
    Description copied from interface: `FacetRecorder`
    Reduce leaf recorder results into this recorder. If `FacetCutter.getOrdinalsToRollup()` result is not null, it also rolls up values.

    After this method is called, it's illegal to add values to recorder, i.e. calling `FacetRecorder.getLeafRecorder(org.apache.lucene.index.LeafReaderContext)` or `LeafFacetRecorder.record(int, int)` on its leaf recorders.

    Specified by:
      `reduce` in interface `FacetRecorder`
    Throws:
      `IOException`

  - ### contains

    public boolean contains(int ordinal)
    Description copied from interface: `FacetRecorder`
    Check if any data was recorded for provided facet ordinal.
    Specified by:
      `contains` in interface `FacetRecorder`

  - ### getRecordedValue

    public long getRecordedValue(int ord, int valuesId)
    Return aggregated value for facet ordinal and aggregation ID, or zero as default.