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 {@link Results} toget 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();