Package org.apache.lucene.facet.sortedset

# Class SortedSetDocValuesReaderState

java.lang.Object
org.apache.lucene.facet.sortedset.SortedSetDocValuesReaderState

All Implemented Interfaces:
  `Accountable`

Direct Known Subclasses:
  `DefaultSortedSetDocValuesReaderState`

public abstract class SortedSetDocValuesReaderState extends Object implements Accountable
Wraps a `IndexReader` and resolves ords using existing `SortedSetDocValues` APIs without a separate taxonomy index. This makes faceting a bit slower, adds some cost at reopen time, but avoids managing the separate taxonomy index. In addition, the tie-break during faceting is now meaningful (in label sorted order).

NOTE: creating an instance of this class is somewhat costly, as it computes per-segment ordinal maps, so you should create it once and re-use that one instance for a given `IndexReader`.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static final class`
  `SortedSetDocValuesReaderState.DimTree`
  Holds children and sibling information for a single dimension.
  `static final record`
  `SortedSetDocValuesReaderState.OrdRange`
  Holds start/end range of ords, which maps to one dimension.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final int`
  `INVALID_ORDINAL`
  Invalid ordinal const

  ### Fields inherited from interface org.apache.lucene.util.Accountable

  `NULL_ACCOUNTABLE`

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `SortedSetDocValuesReaderState()`
  Sole constructor.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `abstract Iterable<String>`
  `getDims()`
  Returns a list of all dimensions
  `abstract SortedSetDocValuesReaderState.DimTree`
  `getDimTree(String dim)`
  Returns mapping from prefix to `SortedSetDocValuesReaderState.DimTree`
  `abstract SortedSetDocValues`
  `getDocValues()`
  Return top-level doc values.
  `abstract FacetsConfig`
  `getFacetsConfig()`
  Returns the associated facet config.
  `abstract String`
  `getField()`
  Indexed field we are reading.
  `abstract SortedSetDocValuesReaderState.OrdRange`
  `getOrdRange(String dim)`
  Returns the `SortedSetDocValuesReaderState.OrdRange` for this dimension.
  `abstract Map<String,SortedSetDocValuesReaderState.OrdRange>`
  `getPrefixToOrdRange()`
  Returns mapping from prefix to `SortedSetDocValuesReaderState.OrdRange`.
  `abstract IndexReader`
  `getReader()`
  Returns top-level index reader.
  `abstract int`
  `getSize()`
  Number of unique labels.

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

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

  ### Methods inherited from interface org.apache.lucene.util.Accountable

  `getChildResources, ramBytesUsed`

- ## Field Details

  - ### INVALID_ORDINAL

    public static final int INVALID_ORDINAL
    Invalid ordinal const
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### SortedSetDocValuesReaderState

    protected SortedSetDocValuesReaderState()
    Sole constructor.

- ## Method Details

  - ### getDocValues

    public abstract SortedSetDocValues getDocValues() throws IOException
    Return top-level doc values.
    Throws:
      `IOException`

  - ### getField

    public abstract String getField()
    Indexed field we are reading.

  - ### getReader

    public abstract IndexReader getReader()
    Returns top-level index reader.

  - ### getSize

    public abstract int getSize()
    Number of unique labels.

  - ### getFacetsConfig

    public abstract FacetsConfig getFacetsConfig()
    Returns the associated facet config.

  - ### getOrdRange

    public abstract SortedSetDocValuesReaderState.OrdRange getOrdRange(String dim)
    Returns the `SortedSetDocValuesReaderState.OrdRange` for this dimension.

  - ### getPrefixToOrdRange

    public abstract Map<String,SortedSetDocValuesReaderState.OrdRange> getPrefixToOrdRange()
    Returns mapping from prefix to `SortedSetDocValuesReaderState.OrdRange`.

  - ### getDimTree

    public abstract SortedSetDocValuesReaderState.DimTree getDimTree(String dim)
    Returns mapping from prefix to `SortedSetDocValuesReaderState.DimTree`

  - ### getDims

    public abstract Iterable<String> getDims()
    Returns a list of all dimensions