google.appengine.api.search.QueryOptions

Options for post-processing results for a query.

Inherits From: expected_type

Options include the ability to sort results, control which document fields to return, produce snippets of fields and compute and sort by complex scoring expressions.

If you wish to randomly access pages of search results, you can use an offset:

get the first set of results

page_size = 10 results = index.search(Query(query_string='some stuff', QueryOptions(limit=page_size))

calculate pages

pages = results.found_count / page_size

user chooses page and hence an offset into results

next_page = ith * page_size

get the search results for that page

results = index.search(Query(query_string='some stuff', QueryOptions(limit=page_size, offset=next_page))

limit The limit on number of documents to return in results.
number_found_accuracy The minimum accuracy requirement for SearchResults.number_found. If set, the number_found will be accurate up to at least that number. For example, when set to 100, any SearchResults with number_found <= 100 is accurate. This option may add considerable latency/expense, especially when used with returned_fields.
cursor A Cursor describing where to get the next set of results, or to provide next cursors in SearchResults.
offset The offset is number of documents to skip in search results. This is an alternative to using a query cursor, but allows random access into the results. Using offsets rather than cursors are more expensive. You can only use either cursor or offset, but not both. Using an offset means that no cursor is returned in SearchResults.cursor, nor in each ScoredDocument.cursor.
sort_options A SortOptions specifying a multi-dimensional sort over search results.
returned_fields An iterable of names of fields to return in search results.
ids_only Only return document ids, do not return any fields.
snippeted_fields An iterable of names of fields to snippet and return in search result expressions.
returned_expressions An iterable of FieldExpression to evaluate and return in search results.

TypeError If an unknown iterator_options or sort_options is passed.
ValueError If ids_only and returned_fields are used together.
ExpressionError If one of the returned expression strings is not parseable.

cursor Returns the Cursor for the query.
ids_only Returns whether to return only document ids in search results.
limit Returns a limit on number of documents to return in results.
number_found_accuracy Returns minimum accuracy requirement for SearchResults.number_found.
offset Returns the number of documents in search results to skip.
returned_expressions Returns iterable of FieldExpression to return in results.
returned_fields Returns an iterable of names of fields to return in search results.
snippeted_fields Returns iterable of field names to snippet and return in results.
sort_options Returns a SortOptions.