SortedNumericSortField

class SortedNumericSortField(field: String, var type: SortField.Type, reverse: Boolean = false, selector: SortedNumericSelector.Type = SortedNumericSelector.Type.MIN) : SortField

SortField for SortedNumericDocValues.

A SortedNumericDocValues contains multiple values for a field, so sorting with this technique "selects" a value as the representative sort value for the document.

By default, the minimum value in the list is selected as the sort value, but this can be customized.

Like sorting by string, this also supports sorting missing values as first or last, via .setMissingValue.

See also

Constructors

Link copied to clipboard
constructor(field: String, type: SortField.Type, reverse: Boolean = false, selector: SortedNumericSelector.Type = SortedNumericSelector.Type.MIN)

Types

Link copied to clipboard
object Companion
Link copied to clipboard

A SortFieldProvider for this sort field

Properties

Link copied to clipboard

Returns the name of the field. Could return null if the sort is by SCORE or DOC.

Link copied to clipboard
open override val indexSorter: IndexSorter

Returns an IndexSorter used for sorting index segments by this SortField.

Link copied to clipboard
open var missingValue: Any?

Return the value to use for documents that don't have a value. A value of null indicates that default should be used.

Link copied to clipboard
Link copied to clipboard

Returns whether sort optimization should be optimized with indexed data

Link copied to clipboard
Link copied to clipboard

Returns whether the sort should be reversed.

Link copied to clipboard
open override var type: SortField.Type

Functions

Link copied to clipboard
open operator override fun equals(obj: Any?): Boolean

Returns true if o is equal to this. If a FieldComparatorSource was provided, it must properly implement equals (unless a singleton is always used).

Link copied to clipboard
Link copied to clipboard
open override fun getComparator(numHits: Int, pruning: Pruning): FieldComparator<*>

Returns the FieldComparator to use for sorting.

Link copied to clipboard

Returns the FieldComparatorSource used for custom sorting

Link copied to clipboard

Returns the selector in use for this sort

Link copied to clipboard
open override fun hashCode(): Int

Returns a hash code for this SortField instance. If a FieldComparatorSource was provided, it must properly implement hashCode (unless a singleton is always used).

Link copied to clipboard
open fun needsScores(): Boolean

Whether the relevance score is needed to sort documents.

Link copied to clipboard
open fun rewrite(searcher: IndexSearcher): SortField

Rewrites this SortField, returning a new SortField if a change is made. Subclasses should override this define their rewriting behavior when this SortField is of type

Link copied to clipboard
Link copied to clipboard
open override fun toString(): String