org.apache.solr.search

## Class Sorting

- java.lang.Object
- - org.apache.solr.search.Sorting

-     public class Sorting
      extends Object

  Extra lucene sorting utilities & convenience methods

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Sorting()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static SortField` | `getStringSortField(String fieldName, boolean reverse, boolean nullLast, boolean nullFirst)` Returns a `SortField` for a string field.
    `static SortField` | `getTextSortField(String fieldName, boolean reverse, boolean nullLast, boolean nullFirst)` Like `getStringSortField(java.lang.String, boolean, boolean, boolean)`) except safe for tokenized fields

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

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Sorting

          public Sorting()

  - ### Method Detail

    - #### getStringSortField

          public static SortField getStringSortField(String fieldName,
                                                     boolean reverse,
                                                     boolean nullLast,
                                                     boolean nullFirst)

      Returns a `SortField` for a string field. If nullLast and nullFirst are both false, then default lucene string sorting is used where null strings sort first in an ascending sort, and last in a descending sort.
      Parameters:
        `fieldName` - the name of the field to sort on
        `reverse` - true for a reverse (desc) sort
        `nullLast` - true if null should come last, regardless of sort order
        `nullFirst` - true if null should come first, regardless of sort order
      Returns:
        SortField

    - #### getTextSortField

          public static SortField getTextSortField(String fieldName,
                                                   boolean reverse,
                                                   boolean nullLast,
                                                   boolean nullFirst)

      Like `getStringSortField(java.lang.String, boolean, boolean, boolean)`) except safe for tokenized fields

Copyright © 2000-2016 Apache Software Foundation. All Rights Reserved.