|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.google.appengine.api.search.SortExpression.Builder
public static final class SortExpression.Builder
A builder that constructs SortExpressions. The user
must provide an expression. The expression can be as simple as a field
name, or can be some other evaluable expression such as
'score + count(likes) * 0.1' which combines a scorer score with a count
of the number of likes values times 0.1. A default value must be specified
for the expression.
SortExpression spec = SortExpression.newBuilder()
.setExpression("score + count(likes) * 0.1")
.setDirection(Scorer.SortDirection.DESCENDING)
.setDefaultValueNumeric(0.0)
.build()
| Method Summary | |
|---|---|
SortExpression |
build()
Builds a SortExpression from the set values. |
SortExpression.Builder |
setDefaultValue(java.lang.String defaultValue)
Sets the default value for the field for sorting purposes. |
SortExpression.Builder |
setDefaultValueNumeric(double defaultValue)
Sets the default value for the field for sorting purposes. |
SortExpression.Builder |
setDirection(SortExpression.SortDirection direction)
Sets the direction to sort the search results in. |
SortExpression.Builder |
setExpression(java.lang.String expression)
Sets an expression to be evaluated for each document to sort by. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public SortExpression.Builder setExpression(java.lang.String expression)
#setDefaultValue() or numeric
setDefaultValueNumeric(double) must be specified for the expression.
expression - the expression to evaluate for each
document to sort by
java.lang.IllegalArgumentException - if the expression is invalidpublic SortExpression.Builder setDirection(SortExpression.SortDirection direction)
direction - the direction to sort the search results in. The
default direction is SortExpression.SortDirection.DESCENDING
public SortExpression.Builder setDefaultValue(java.lang.String defaultValue)
defaultValue - the default value for the field
java.lang.IllegalArgumentException - if the defaultValue is not validpublic SortExpression.Builder setDefaultValueNumeric(double defaultValue)
defaultValue - the default value for the field
public SortExpression build()
SortExpression from the set values.
SortExpression built from the set values
java.lang.IllegalArgumentException - if the field name or
default value is invalid
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||