xybrek xybrek - 10 months ago 48
Java Question

Setting Cursor for a GAE Search query

The document doesn't seem to elaborate on how to actually set a start cursor when performing a search like this:

Results<ScoredDocument> results = index.search(queryString);

Getting the cursor is easy:


But setting a start cursor for the
is not documented? Looking at the code I can see a
object as another parameter for the
method, yet again there is no example on how to build a
for search to which we can add the cursor.

Answer Source

Example can be found here: https://cloud.google.com/appengine/docs/java/javadoc/com/google/appengine/api/search/Query

QueryOptions options = QueryOptions.newBuilder()
     .setFieldsToSnippet("subject", "body")
 Query query = Query.newBuilder()
     .build("good story");