SortField.Type (Lucene 10.5.1 core API)
Description: declaration: package: org.apache.lucene.search, class: SortField, enum: Type

Package org.apache.lucene.search

# Enum Class SortField.Type

java.lang.Object
java.lang.Enum<SortField.Type>
org.apache.lucene.search.SortField.Type

All Implemented Interfaces:
  `Serializable`, `Comparable<SortField.Type>`, `Constable`

Enclosing class:
  `SortField`

public static enum SortField.Type extends Enum<SortField.Type>
Specifies the type of the terms to be sorted, or special types such as CUSTOM

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from class java.lang.Enum

  `Enum.EnumDesc<E extends Enum<E>>`

- ## Enum Constant Summary

  Enum Constants
  Enum Constant
  Description
  `CUSTOM`
  Sort using a custom Comparator.
  `DOC`
  Sort by document number (index order).
  `DOUBLE`
  Sort using term values as encoded Doubles.
  `FLOAT`
  Sort using term values as encoded Floats.
  `INT`
  Sort using term values as encoded Integers.
  `LONG`
  Sort using term values as encoded Longs.
  `REWRITEABLE`
  Force rewriting of SortField using `SortField.rewrite(IndexSearcher)` before it can be used for sorting
  `SCORE`
  Sort by document score (relevance).
  `STRING`
  Sort using term values as Strings.
  `STRING_VAL`
  Sort using term values as Strings, but comparing by value (using String.compareTo) for all comparisons.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static SortField.Type`
  `valueOf(String name)`
  Returns the enum constant of this class with the specified name.
  `static SortField.Type[]`
  `values()`
  Returns an array containing the constants of this enum class, in the order they are declared.

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

  `clone, compareTo, describeConstable, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf`

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

  `getClass, notify, notifyAll, wait, wait, wait`

- ## Enum Constant Details

  - ### SCORE

    public static final SortField.Type SCORE
    Sort by document score (relevance). Sort values are Float and higher values are at the front.

  - ### DOC

    public static final SortField.Type DOC
    Sort by document number (index order). Sort values are Integer and lower values are at the front.

  - ### STRING

    public static final SortField.Type STRING
    Sort using term values as Strings. Sort values are String and lower values are at the front.

  - ### INT

    public static final SortField.Type INT
    Sort using term values as encoded Integers. Sort values are Integer and lower values are at the front. Fields must either be not indexed, or indexed with `IntPoint`.

  - ### FLOAT

    public static final SortField.Type FLOAT
    Sort using term values as encoded Floats. Sort values are Float and lower values are at the front. Fields must either be not indexed, or indexed with `FloatPoint`.

  - ### LONG

    public static final SortField.Type LONG
    Sort using term values as encoded Longs. Sort values are Long and lower values are at the front. Fields must either be not indexed, or indexed with `LongPoint`.

  - ### DOUBLE

    public static final SortField.Type DOUBLE
    Sort using term values as encoded Doubles. Sort values are Double and lower values are at the front. Fields must either be not indexed, or indexed with `DoublePoint`.

  - ### CUSTOM

    public static final SortField.Type CUSTOM
    Sort using a custom Comparator. Sort values are any Comparable and sorting is done according to natural order.

  - ### STRING_VAL

    public static final SortField.Type STRING_VAL
    Sort using term values as Strings, but comparing by value (using String.compareTo) for all comparisons. This is typically slower than `STRING`, which uses ordinals to do the sorting.

  - ### REWRITEABLE

    public static final SortField.Type REWRITEABLE
    Force rewriting of SortField using `SortField.rewrite(IndexSearcher)` before it can be used for sorting

- ## Method Details

  - ### values

    public static SortField.Type[] values()
    Returns an array containing the constants of this enum class, in the order they are declared.
    Returns:
      an array containing the constants of this enum class, in the order they are declared

  - ### valueOf

    public static SortField.Type valueOf(String name)
    Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
    Parameters:
      `name` - the name of the enum constant to be returned.
    Returns:
      the enum constant with the specified name
    Throws:
      `IllegalArgumentException` - if this enum class has no constant with the specified name
      `NullPointerException` - if the argument is null