Class SolrQuery.SortClause
java.lang.Object
org.apache.solr.client.solrj.request.SolrQuery.SortClause
- All Implemented Interfaces:
Serializable
- Enclosing class:
SolrQuery
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 as sum(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:
-
Constructor Summary
ConstructorsConstructorDescriptionSortClause(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
Modifier and TypeMethodDescriptionstatic SolrQuery.SortClauseCreates an ascending SortClause for an itemstatic SolrQuery.SortClauseCreates a SortClause based on item and orderstatic SolrQuery.SortClausecreate(String item, SolrQuery.ORDER order) Creates an ascending SortClause for an itemstatic SolrQuery.SortClauseCreates a descending SortClause for an itembooleangetItem()Gets the item to sort, typically a function or a field namegetOrder()Gets the order to sortinthashCode()toString()Gets a human-readable description of the sort clause.
-
Constructor Details
-
SortClause
Creates a SortClause based on item and order- Parameters:
item- item to sort onorder- direction to sort
-
SortClause
Creates a SortClause based on item and order- Parameters:
item- item to sort onorder- string value for direction to sort
-
-
Method Details
-
create
Creates an ascending SortClause for an item- Parameters:
item- item to sort on
-
create
Creates a SortClause based on item and order- Parameters:
item- item to sort onorder- string value for direction to sort
-
asc
Creates an ascending SortClause for an item- Parameters:
item- item to sort on
-
desc
Creates a descending SortClause for an item- Parameters:
item- item to sort on
-
getItem
Gets the item to sort, typically a function or a field name- Returns:
- item to sort
-
getOrder
Gets the order to sort- Returns:
- order to sort by
-
equals
-
hashCode
public int hashCode() -
toString
Gets a human-readable description of the sort clause.The returned string is not suitable for passing to Solr, but may be useful in debug output and the like.
-