public final class SortExpression
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
SortExpression.Builder
A builder that constructs
SortExpressions. |
static class |
SortExpression.SortDirection
The direction search results are sorted by, either ascending or descending.
|
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
DOCUMENT_ID_FIELD_NAME
The expression to be used if you wish to sort by document id field
Document.getId(). |
static java.lang.String |
LANGUAGE_FIELD_NAME
The expression to be used if you wish to sort by language
code associated with the locale field
Document.getLocale(). |
static java.lang.String |
RANK_FIELD_NAME
The expression to be used if you wish to sort by rank field.
|
static java.lang.String |
SCORE_FIELD_NAME
The expression to be used if you wish to sort by document score.
|
static java.lang.String |
TIMESTAMP_FIELD_NAME
The expression to be used if you wish to sort by
seconds since EPOCH that the document was written.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getDefaultValue() |
java.util.Date |
getDefaultValueDate() |
java.lang.Double |
getDefaultValueNumeric() |
SortExpression.SortDirection |
getDirection() |
java.lang.String |
getExpression() |
static SortExpression.Builder |
newBuilder()
Creates and returns a SortExpression Builder.
|
java.lang.String |
toString() |
public static final java.lang.String DOCUMENT_ID_FIELD_NAME
Document.getId().
You need to create a sort expression as
SortExpression expr = SortExpression.newBuilder()
.setExpression(SortExpression.DOCUMENT_ID_FIELD_NAME)
.setDefaultValue("")
.build();
public static final java.lang.String LANGUAGE_FIELD_NAME
Document.getLocale().
You need to create a sort expression as
SortExpression expr = SortExpression.newBuilder()
.setExpression(SortExpression.LANGUAGE_FIELD_NAME)
.setDefaultValue("")
.build();
public static final java.lang.String RANK_FIELD_NAME
SortExpression expr = SortExpression.newBuilder()
.setExpression(SortExpression.RANK_FIELD_NAME)
.setDirection(SortExpression.SortDirection.ASCENDING)
.setDefaultValueNumeric(0)
.build();
public static final java.lang.String SCORE_FIELD_NAME
SortExpression expr = SortExpression.newBuilder()
.setExpression(String.format(
"%s + rating * 0.01", SortExpression.SCORE_FIELD_NAME))
.setDirection(SortExpression.SortDirection.DESCENDING)
.setDefaultValueNumeric(0)
.build();
public static final java.lang.String TIMESTAMP_FIELD_NAME
SortExpression expr = SortExpression.newBuilder()
.setExpression(SortExpression.TIMESTAMP_FIELD_NAME)
.setDefaultValueNumeric(0)
.build();
public java.lang.String getExpression()
public SortExpression.SortDirection getDirection()
public java.lang.String getDefaultValue()
public java.lang.Double getDefaultValueNumeric()
public java.util.Date getDefaultValueDate()
public static SortExpression.Builder newBuilder()
SortExpression.Builder. Set the parameters for the sort
specification on the Builder, and use the SortExpression.Builder.build() method
to create a concrete instance of SortExpressionpublic java.lang.String toString()
toString in class java.lang.Object