Package org.apache.lucene.search

## Enum SortField.Type

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

- All Implemented Interfaces:
    `Serializable`, `Comparable<SortField.Type>`
  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

- - ### 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

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static SortField.Type` | `valueOf​(String name)` | Returns the enum constant of this type with the specified name.
    `static SortField.Type[]` | `values()` | Returns an array containing the constants of this enum type, in the order they are declared.

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

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

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

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

- - ### Enum Constant Detail

    - #### 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 Detail

    - #### values

          public static SortField.Type[] values()

      Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:

          for (SortField.Type c : SortField.Type.values())
              System.out.println(c);

      Returns:
        an array containing the constants of this enum type, in the order they are declared

    - #### valueOf

          public static SortField.Type valueOf​(String name)

      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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 type has no constant with the specified name
        `NullPointerException` - if the argument is null