IndexSorter.IntSorter (Lucene 10.5.0 core API)
Description: declaration: package: org.apache.lucene.index, interface: IndexSorter, class: IntSorter

Package org.apache.lucene.index

# Class IndexSorter.IntSorter

java.lang.Object
org.apache.lucene.index.IndexSorter.IntSorter

All Implemented Interfaces:
  `IndexSorter`

Enclosing interface:
  `IndexSorter`

public static final class IndexSorter.IntSorter extends Object implements IndexSorter
Sorts documents based on integer values from a NumericDocValues instance

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from interface org.apache.lucene.index.IndexSorter

  `IndexSorter.BinaryDocValuesProvider, IndexSorter.BinarySorter, IndexSorter.ComparableProvider, IndexSorter.ComparableValues, IndexSorter.DocComparator, IndexSorter.DoubleSorter, IndexSorter.FloatSorter, IndexSorter.IntSorter, IndexSorter.LongSorter, IndexSorter.NumericDocValuesProvider, IndexSorter.SortedDocValuesProvider, IndexSorter.StringSorter`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `IntSorter(String providerName, Integer missingValue, boolean reverse, IndexSorter.NumericDocValuesProvider valuesProvider)`
  Creates a new IntSorter

- ## Method Summary

  Modifier and Type
  Method
  Description
  `IndexSorter.ComparableProvider[]`
  `getComparableProviders(List<? extends LeafReader> readers)`
  Get an array of `IndexSorter.ComparableProvider`, one per segment, for merge sorting documents in different segments.
  `IndexSorter.DocComparator`
  `getDocComparator(LeafReader reader, int maxDoc)`
  Get a comparator that determines the sort order of docs within a single Reader.
  `String`
  `getProviderName()`
  The SPI-registered name of a `SortFieldProvider` that will deserialize the parent SortField

  ### 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.index.IndexSorter

  `getComparableValues`

- ## Constructor Details

  - ### IntSorter

    public IntSorter(String providerName, Integer missingValue, boolean reverse, IndexSorter.NumericDocValuesProvider valuesProvider)
    Creates a new IntSorter

- ## Method Details

  - ### getComparableProviders

    public IndexSorter.ComparableProvider[] getComparableProviders(List<? extends LeafReader> readers) throws IOException
    Description copied from interface: `IndexSorter`
    Get an array of `IndexSorter.ComparableProvider`, one per segment, for merge sorting documents in different segments.

    Implementations whose sort value is a `long` should implement this method; it is exposed to the merger through the default `IndexSorter.getComparableValues(List)`. Implementations that override `IndexSorter.getComparableValues(List)` directly need not implement this method.

    Specified by:
      `getComparableProviders` in interface `IndexSorter`
    Parameters:
      `readers` - the readers to be merged
    Throws:
      `IOException`

  - ### getDocComparator

    public IndexSorter.DocComparator getDocComparator(LeafReader reader, int maxDoc) throws IOException
    Description copied from interface: `IndexSorter`
    Get a comparator that determines the sort order of docs within a single Reader.

    NB We cannot simply use the `FieldComparator` API because it requires docIDs to be sent in-order. The default implementations allocate array[maxDoc] to hold native values for comparison, but 1) they are transient (only alive while sorting this one segment) and 2) in the typical index sorting case, they are only used to sort newly flushed segments, which will be smaller than merged segments

    Specified by:
      `getDocComparator` in interface `IndexSorter`
    Parameters:
      `reader` - the Reader to sort
      `maxDoc` - the number of documents in the Reader
    Throws:
      `IOException`

  - ### getProviderName

    public String getProviderName()
    Description copied from interface: `IndexSorter`
    The SPI-registered name of a `SortFieldProvider` that will deserialize the parent SortField
    Specified by:
      `getProviderName` in interface `IndexSorter`