SortField

open class SortField

Stores information about how to sort documents by terms in an individual field. Fields must be indexed in order to sort by them.

Sorting on a numeric field that is indexed with both doc values and points may use an optimization to skip non-competitive documents. This optimization relies on the assumption that the same data is stored in these points and doc values.

Sorting on a SORTED(_SET) field that is indexed with both doc values and term index may use an optimization to skip non-competitive documents. This optimization relies on the assumption that the same data is stored in these term index and doc values.

Created: Feb 11, 2004 1:25:29 PM

Since

lucene 1.4

See also

Inheritors

Constructors

Link copied to clipboard
constructor(field: String?, type: SortField.Type)

Creates a sort by terms in the given field with the type of term values explicitly given.

constructor(field: String?, type: SortField.Type, reverse: Boolean)

Creates a sort, possibly in reverse, by terms in the given field with the type of term values explicitly given.

constructor(field: String?, comparator: FieldComparatorSource)

Creates a sort with a custom comparison function.

constructor(field: String?, comparator: FieldComparatorSource, reverse: Boolean)

Creates a sort, possibly in reverse, with a custom comparison function.

Types

Link copied to clipboard
object Companion
Link copied to clipboard

A SortFieldProvider for field sorts

Link copied to clipboard

Specifies the type of the terms to be sorted, or special types such as CUSTOM

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

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

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 lateinit var type: SortField.Type

Functions

Link copied to clipboard
open operator override fun equals(o: 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 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
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