org.apache.solr.search
Class SortSpec

java.lang.Object
  extended by 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
SortSpec(Sort sort, int num)
          Deprecated. Specify both Sort and SchemaField[] when constructing
SortSpec(Sort sort, int offset, int num)
          Deprecated. Specify both Sort and SchemaField[] when constructing
SortSpec(Sort sort, List<SchemaField> fields)
           
SortSpec(Sort sort, SchemaField[] fields)
           
 
Method Summary
 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 setSort(Sort s)
          Deprecated. use setSortAndFields(org.apache.lucene.search.Sort, java.util.List)
 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)

SortSpec

@Deprecated
public SortSpec(Sort sort,
                           int num)
Deprecated. Specify both Sort and SchemaField[] when constructing


SortSpec

@Deprecated
public SortSpec(Sort sort,
                           int offset,
                           int num)
Deprecated. Specify both Sort and SchemaField[] when constructing

Method Detail

setSort

@Deprecated
public void setSort(Sort s)
Deprecated. use setSortAndFields(org.apache.lucene.search.Sort, java.util.List)


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-2014 Apache Software Foundation. All Rights Reserved.