org.apache.solr.search

Class SortSpec



  • public class SortSpec
    extends Object
    SortSpec encapsulates a Lucene Sort and a count of the number of documents to return.
    • 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.
      • getSort

        public Sort getSort()
        Gets the Lucene Sort object, or null for the default sort by score descending.
      • getSchemaFields

        public List<SchemaFieldgetSchemaFields()
        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)