Class SortSpec


  • public class SortSpec
    extends Object
    SortSpec encapsulates a Lucene Sort and a count of the number of documents to return.
    • Constructor Detail

      • SortSpec

        public SortSpec​(org.apache.lucene.search.Sort sort,
                        List<SchemaField> fields,
                        int num,
                        int offset)
      • SortSpec

        public SortSpec​(org.apache.lucene.search.Sort sort,
                        List<SchemaField> fields)
      • SortSpec

        public SortSpec​(org.apache.lucene.search.Sort sort,
                        SchemaField[] fields,
                        int num,
                        int offset)
      • SortSpec

        public SortSpec​(org.apache.lucene.search.Sort sort,
                        SchemaField[] fields)
    • Method Detail

      • setSortAndFields

        public void setSortAndFields​(org.apache.lucene.search.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​(org.apache.lucene.search.Sort sort)
      • includesScore

        public boolean includesScore()
      • getSort

        public org.apache.lucene.search.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)