org.apache.solr.search

## Class SortSpec

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

-     public class SortSpec
      extends Object

  SortSpec encapsulates a Lucene Sort and a count of the number of documents to return.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `SortSpec(Sort sort, List<SchemaField> fields)`
    `SortSpec(Sort sort, SchemaField[] fields)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `getCount()` Gets the number of documents to return after sorting.
    `int` | `getOffset()` Offset into the list of results.
    `List<SchemaField>` | `getSchemaFields()` Gets the Solr SchemaFields that correspond to each of the SortFields used in this sort.
    `Sort` | `getSort()` Gets the Lucene Sort object, or null for the default sort by score descending.
    `boolean` | `includesScore()`
    `static boolean` | `includesScore(Sort sort)`
    `void` | `setCount(int count)`
    `void` | `setOffset(int offset)`
    `void` | `setSortAndFields(Sort s, List<SchemaField> fields)` the specified SchemaFields must correspond one to one with the Sort's SortFields, using null where appropriate.
    `String` | `toString()`

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

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

- - ### Constructor Detail

    - #### SortSpec

          public SortSpec(Sort sort,
                          List<SchemaField> fields)

    - #### SortSpec

          public SortSpec(Sort sort,
                          SchemaField[] fields)

  - ### Method Detail

    - #### setSortAndFields

          public void setSortAndFields(Sort s,
                                       List<SchemaField> fields)

      the specified SchemaFields must correspond one to one with the Sort's SortFields, using null where appropriate.

    - #### includesScore

          public static boolean includesScore(Sort sort)

    - #### includesScore

          public boolean includesScore()

    - #### getSort

          public Sort getSort()

      Gets the Lucene Sort object, or null for the default sort by score descending.

    - #### getSchemaFields

          public List<SchemaField> getSchemaFields()

      Gets the Solr SchemaFields that correspond to each of the SortFields used in this sort. The array may contain null if a SortField doesn't correspond directly to a SchemaField (ie: score, lucene docid, custom function sorting, etc...)
      Returns:
        an immutable list, may be empty if getSort is null

    - #### getOffset

          public int getOffset()

      Offset into the list of results.

    - #### setOffset

          public void setOffset(int offset)

    - #### getCount

          public int getCount()

      Gets the number of documents to return after sorting.
      Returns:
        number of docs to return, or -1 for no cut off (just sort)

    - #### setCount

          public void setCount(int count)

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

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