Pagination
The last piece of the puzzle is pagination. So let's look into that. By default when you issue an index.search()
call, the first 20 matching documents are returned and the result is actually a search.SearchResult
instance, which has the following properties:
results
: This are the list ofScoreDocument
instances. Each object in this list hasfields
property that we already have seen. The number of items by default are 20 but you can increase that number by supplying alimit
keyword argument tosearch.QueryOptions
.cursor
: This is a pointer to the last document in the results list above. So the next time you executeindex.search()
with the same query and pass this ascursor
keyword argument, the read operation will start from that point. ...
Get Mastering Google App Engine now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.