Closed Chronial closed 8 years ago
@Chronial
Hi,
cursors seems to be a good improvement and it would nice if we have support for this in sunburnt.
Your pull request looks fine but I am missing support for building solr queries with allready available cursor marks. Our typical use cases are web views which allow paging over a given result set. So far I see your implementation only allows to build queries starting with cursor mark '*'.
Maybe a simple
def cursor(self, constructor=None, rows=None, cursor_mark='*'): ... return SolrCursor(search, constructor, cursor_mark)
will fix this. Any idea?
Best regards, Martin
Mhh, that would not solve that completely, as you don't have access to the current cursor mark in the iterator. Also this seems to be asking for trouble as you have to make sure you send the exact same query as before with the cursor mark. I think a high-level library like scorched should help with this. You could serialize the cursor object and reconstruct it later on – this way you have the current cursor mark and the query together.
But then again, that would be counter-intuitive as you would expect to serialize the current iterator position, but that is not possible (we could try to iterate till we get to the last seen item, but that item might not exist anymore). But this is now a limit of solr, not of this implementation.
Are you sure cursors are the right fit for your situation? How would you go back to a previously visited page?
@Chronial
Yeah, I see the point. We have lots of traditional web based paging and cursors will not help us (going back/forward; jumping directly to a page).
And yes,
thanks for the patch :)
This adds support for solr cursors (https://cwiki.apache.org/confluence/display/solr/Pagination+of+Results#PaginationofResults-FetchingALargeNumberofSortedResults:Cursors)