python - Google App engine Search API Cursor not not updating -
i using cursors results gae full text search api. roblem cursor remains same in each iteration:
cursor = search.cursor() files_options = search.queryoptions( limit=5, cursor=cursor, returned_fields='state' ) files_dict = {} query = search.query(query_string=text_to_search, options=files_options) index = search.index(name='title') while cursor != none: results = index.search(query) cursor = results.cursor
the cursor never become none when search returns 18 results
the problem getting same 5 results on , on again. every time results = index.search(query)
inside loop, you're retrieving first 5 results because query options specify limit of 5 , empty cursor. need create new query starting new cursor on every iteration.
cursor = search.cursor() index = search.index(name='title') while cursor != none: options = search.queryoptions(limit=5, cursor=cursor, returned_fields='state')) results = index.search(search.query(query_string=text_to_search, options=options)) cursor = results.cursor
take @ introduction section of page: https://developers.google.com/appengine/docs/python/search/queryclass
Comments
Post a Comment