IndexSorter

interface IndexSorter

Handles how documents should be sorted in an index, both within a segment and between segments.

Implementers must provide the following methods:

  • .getDocComparator - an object that determines how documents within a segment are to be sorted

  • .getComparableProviders - an array of objects that return a sortable long value per document and segment

  • .getProviderName - the SPI-registered name of a SortFieldProvider to serialize the sort

The companion SortFieldProvider should be registered with SPI via META-INF/services

Inheritors

Types

Link copied to clipboard

Used for sorting documents across segments

Link copied to clipboard
fun interface DocComparator

A comparator of doc IDs, used for sorting documents within a segment

Link copied to clipboard
class DoubleSorter(val providerName: String, missingValue: Double?, reverse: Boolean, valuesProvider: IndexSorter.NumericDocValuesProvider) : IndexSorter

Sorts documents based on double values from a NumericDocValues instance

Link copied to clipboard
class FloatSorter(val providerName: String, missingValue: Float?, reverse: Boolean, valuesProvider: IndexSorter.NumericDocValuesProvider) : IndexSorter

Sorts documents based on float values from a NumericDocValues instance

Link copied to clipboard
class IntSorter(val providerName: String, missingValue: Int?, reverse: Boolean, valuesProvider: IndexSorter.NumericDocValuesProvider) : IndexSorter

Sorts documents based on integer values from a NumericDocValues instance

Link copied to clipboard
class LongSorter(val providerName: String, missingValue: Long?, reverse: Boolean, valuesProvider: IndexSorter.NumericDocValuesProvider) : IndexSorter

Sorts documents based on long values from a NumericDocValues instance

Link copied to clipboard

Provide a NumericDocValues instance for a LeafReader

Link copied to clipboard

Provide a SortedDocValues instance for a LeafReader

Link copied to clipboard
open class StringSorter(val providerName: String, missingValue: Any?, reverse: Boolean, valuesProvider: IndexSorter.SortedDocValuesProvider) : IndexSorter

Sorts documents based on terms from a SortedDocValues instance

Properties

Link copied to clipboard
abstract val providerName: String

The SPI-registered name of a SortFieldProvider that will deserialize the parent SortField

Functions

Link copied to clipboard

Get an array of ComparableProvider, one per segment, for merge sorting documents in different segments

Link copied to clipboard

Get a comparator that determines the sort order of docs within a single Reader.