|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.google.appengine.api.search.SearchRequest
public final class SearchRequest
A request to search an index for documents which match a query, restricting the document fields returned to those given, and scoring and sorting the results, whilst supporting pagination.
For example, the following request will search for documents where
the tokens 'good' and 'story' occur in some fields,
returns 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 SearchResponse
to get the next
batch of results after this.
SearchRequest request = SearchRequest.newBuilder() .setQuery("good story") .setLimit(20) .setFieldsToReturn("author", "date-sent") .setFieldsToSnippet("subject", "body") .addSortSpec(SortSpec.newBuilder() .setExpression("author") .setDirection(SortDirection.DESCENDING) .setDefaultValue("")) .setCursor(responseCursor) .setCursorType(CursorType.RESPONSE_CURSOR) .build();
Nested Class Summary | |
---|---|
static class |
SearchRequest.Builder
A builder which constructs SearchRequest objects. |
static class |
SearchRequest.CursorType
Use a cursor returned from a previous set of search results as a starting point to retrieve the next set of results. |
Method Summary | |
---|---|
java.lang.String |
getCursor()
|
SearchRequest.CursorType |
getCursorType()
|
java.util.List<FieldExpression> |
getExpressionsToReturn()
|
java.util.List<java.lang.String> |
getFieldsToReturn()
|
java.util.List<java.lang.String> |
getFieldsToSnippet()
|
int |
getLimit()
|
int |
getMatchedCountAccuracy()
Any SearchResponse.getMatchedCount() less than or equal to this
setting will be accurate. |
int |
getOffset()
|
java.lang.String |
getQuery()
The query can be as simple as a single term ("foo"), or as complex as a boolean expression, including field names ("title:hello OR body:important -october"). |
java.util.List<SortSpec> |
getSortSpecs()
|
boolean |
isReturningIdsOnly()
|
static SearchRequest.Builder |
newBuilder()
Creates and returns a SearchRequest builder. |
static SearchRequest.Builder |
newBuilder(SearchRequest 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 java.lang.String getQuery()
public int getLimit()
public java.lang.String getCursor()
public int getOffset()
public SearchRequest.CursorType getCursorType()
public int getMatchedCountAccuracy()
SearchResponse.getMatchedCount()
less than or equal to this
setting will be accurate.
public java.util.List<SortSpec> getSortSpecs()
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 SearchRequest.Builder newBuilder()
SearchRequest
builder. Set the search request
parameters and use the SearchRequest.Builder.build()
method to create a concrete
instance of SearchRequest.
SearchRequest.Builder
which can construct a search requestpublic static SearchRequest.Builder newBuilder(SearchRequest 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 |