How To Page The Dataset
Solution 1:
Query cursors are built for exactly this. You should use them instead of building your own solution.
Solution 2:
You may need to base64 encoded your bookmark before you pass it to client. I have tried [Your site][1], but it is impossible to answer your question clearly without the server side error message.
Moreover, as the paging article has mentioned, using datetime as bookmark directly will cause issues while there are more than one articles posted in the same time period (in your case, the time period will be one minute). You may want to consider using this format instead.
2008-10-26 04:38:00|aee15ab24b7b3718596e3acce04fba85
or using seconds to represent the time.
1310427763.47|aee15ab24b7b3718596e3acce04fba85
should I set it to datetime.now() if it's the first page that gets viewed?
You can get the first page results by simply ignore the modified filter. For example:
if bookmark:
suggestions = Suggestion.all().order("-when")
.filter('when <=', bookmark).fetch(PAGESIZE+1)
else:
suggestions = Suggestion.all().order("-when").fetch(PAGESIZE+1)
or using the current time as bookmark.
import time
bookmark = str(time.time())
Post a Comment for "How To Page The Dataset"