public final class QueryOptions
extends java.lang.Object
For example, the following options will return documents from search
results for some given query, returning up to 20 results including the
fields 'author' and 'date-sent' as well as snippeted fields 'subject' and
'body'. The results are sorted by 'author' in descending order, getting
the next 20 results from the responseCursor in the previously returned
results, giving back a single cursor in the Results
to
get the next batch of results after this.
QueryOptions request = QueryOptions.newBuilder() .setLimit(20) .setFieldsToReturn("author", "date-sent") .setFieldsToSnippet("subject", "body") .setSortOptions(SortOptions.newBuilder(). .addSortExpression(SortExpression.newBuilder() .setExpression("author") .setDirection(Scorer.SortDirection.DESCENDING) .setDefaultValue(""))) .setCursor(Cursor.newBuilder().build()) .build();
Modifier and Type | Class and Description |
---|---|
static class |
QueryOptions.Builder
A builder which constructs QueryOptions objects.
|
Modifier and Type | Method and Description |
---|---|
Cursor |
getCursor() |
java.util.List<FieldExpression> |
getExpressionsToReturn() |
java.util.List<java.lang.String> |
getFieldsToReturn() |
java.util.List<java.lang.String> |
getFieldsToSnippet() |
int |
getLimit() |
int |
getNumberFoundAccuracy()
Any
Results.getNumberFound() less than or equal to this
setting will be accurate. |
int |
getOffset() |
SortOptions |
getSortOptions() |
boolean |
hasNumberFoundAccuracy()
Returns true iff there is an accuracy requirement set.
|
boolean |
isReturningIdsOnly() |
static QueryOptions.Builder |
newBuilder()
Creates and returns a
QueryOptions builder. |
static QueryOptions.Builder |
newBuilder(QueryOptions request)
Creates a builder from the given request.
|
java.lang.String |
toString() |
public int getLimit()
public Cursor getCursor()
public int getOffset()
public boolean hasNumberFoundAccuracy()
public int getNumberFoundAccuracy()
Results.getNumberFound()
less than or equal to this
setting will be accurate.public SortOptions getSortOptions()
SortOptions
specifying how to sort Documents in
Results
public boolean isReturningIdsOnly()
public java.util.List<java.lang.String> getFieldsToReturn()
public java.util.List<java.lang.String> getFieldsToSnippet()
public java.util.List<FieldExpression> getExpressionsToReturn()
public static QueryOptions.Builder newBuilder()
QueryOptions
builder. Set the search request
parameters and use the QueryOptions.Builder.build()
method to create a concrete
instance of QueryOptions.QueryOptions.Builder
which can construct a search requestpublic static QueryOptions.Builder newBuilder(QueryOptions request)
request
- the search request for the builder to use
to build another requestpublic java.lang.String toString()
toString
in class java.lang.Object