Package org.apache.solr.search
Class SortSpec
java.lang.Object
org.apache.solr.search.SortSpec
SortSpec encapsulates a Lucene Sort and a count of the number of documents to return.
-
Constructor Summary
ConstructorsConstructorDescriptionSortSpec(org.apache.lucene.search.Sort sort, List<SchemaField> fields) SortSpec(org.apache.lucene.search.Sort sort, List<SchemaField> fields, int num, int offset) SortSpec(org.apache.lucene.search.Sort sort, SchemaField[] fields) SortSpec(org.apache.lucene.search.Sort sort, SchemaField[] fields, int num, int offset) -
Method Summary
Modifier and TypeMethodDescriptionintgetCount()Gets the number of documents to return after sorting.intOffset into the list of results.Gets the Solr SchemaFields that correspond to each of the SortFields used in this sort.org.apache.lucene.search.SortgetSort()Gets the Lucene Sort object, or null for the default sort by score descending.booleanReturns whether SortFields for the Sort includes a field besides SortField.Type.SCORE or SortField.Type.DOCstatic booleanincludesNonScoreOrDocField(org.apache.lucene.search.Sort sort) Returns whether SortFields for the Sort includes a field besides SortField.Type.SCORE or SortField.Type.DOCbooleanstatic booleanincludesScore(org.apache.lucene.search.Sort sort) voidsetCount(int count) voidsetOffset(int offset) voidsetSortAndFields(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.toString()
-
Constructor Details
-
SortSpec
-
SortSpec
-
SortSpec
-
SortSpec
-
-
Method Details
-
setSortAndFields
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() -
includesNonScoreOrDocField
public boolean includesNonScoreOrDocField()Returns whether SortFields for the Sort includes a field besides SortField.Type.SCORE or SortField.Type.DOC- Returns:
- true if SortFields contains a field besides score or the Lucene doc
-
includesNonScoreOrDocField
public static boolean includesNonScoreOrDocField(org.apache.lucene.search.Sort sort) Returns whether SortFields for the Sort includes a field besides SortField.Type.SCORE or SortField.Type.DOC- Parameters:
sort- org.apache.lucene.search.Sort- Returns:
- true if SortFields contains a field besides score or the Lucene doc
-
getSort
public org.apache.lucene.search.Sort getSort()Gets the Lucene Sort object, or null for the default sort by score descending. -
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
-