|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.google.appengine.api.search.QueryOptions
public final class QueryOptions
Represents options which control where and what in the search results to return, from restricting the document fields returned to those given, and scoring and sorting the results, whilst supporting pagination.
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();
| Nested Class Summary | |
|---|---|
static class |
QueryOptions.Builder
A builder which constructs QueryOptions objects. |
| Method Summary | |
|---|---|
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 |
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()
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Method Detail |
|---|
public int getLimit()
public Cursor getCursor()
public int getOffset()
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
Resultspublic 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
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||