Package org.apache.solr.client.solrj
Class SolrQuery.SortClause
- java.lang.Object
-
- org.apache.solr.client.solrj.SolrQuery.SortClause
-
- All Implemented Interfaces:
Serializable
- Enclosing class:
- SolrQuery
public static class SolrQuery.SortClause extends Object implements Serializable
A single sort clause, encapsulating what to sort and the sort order.The item specified can be "anything sortable" by solr; some examples include a simple field name, the constant string
score
, and functions such assum(x_f, y_f)
.A SortClause can be created through different mechanisms:
new SortClause("product", SolrQuery.ORDER.asc); new SortClause("product", "asc"); SortClause.asc("product"); SortClause.desc("product");
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description SortClause(String item, String order)
Creates a SortClause based on item and orderSortClause(String item, SolrQuery.ORDER order)
Creates a SortClause based on item and order
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SolrQuery.SortClause
asc(String item)
Creates an ascending SortClause for an itemstatic SolrQuery.SortClause
create(String item, String order)
Creates a SortClause based on item and orderstatic SolrQuery.SortClause
create(String item, SolrQuery.ORDER order)
Creates an ascending SortClause for an itemstatic SolrQuery.SortClause
desc(String item)
Creates a decending SortClause for an itemboolean
equals(Object other)
String
getItem()
Gets the item to sort, typically a function or a fieldnameSolrQuery.ORDER
getOrder()
Gets the order to sortint
hashCode()
String
toString()
Gets a human readable description of the sort clause.
-
-
-
Constructor Detail
-
SortClause
public SortClause(String item, SolrQuery.ORDER order)
Creates a SortClause based on item and order- Parameters:
item
- item to sort onorder
- direction to sort
-
-
Method Detail
-
create
public static SolrQuery.SortClause create(String item, SolrQuery.ORDER order)
Creates an ascending SortClause for an item- Parameters:
item
- item to sort on
-
create
public static SolrQuery.SortClause create(String item, String order)
Creates a SortClause based on item and order- Parameters:
item
- item to sort onorder
- string value for direction to sort
-
asc
public static SolrQuery.SortClause asc(String item)
Creates an ascending SortClause for an item- Parameters:
item
- item to sort on
-
desc
public static SolrQuery.SortClause desc(String item)
Creates a decending SortClause for an item- Parameters:
item
- item to sort on
-
getItem
public String getItem()
Gets the item to sort, typically a function or a fieldname- Returns:
- item to sort
-
getOrder
public SolrQuery.ORDER getOrder()
Gets the order to sort- Returns:
- order to sort
-
-