I am new to solr and trying to implement the pagination feature on my search page. Initially I was using the basic pagination method mentioned here: https://cwiki.apache.org/confluence/display/solr/Pagination+of+Results
So moving to next and previous pages both were fine as I can just change the index over there. But how do I go to the previous page using cusrsorMark
as solr only returns the nextCursorMark
.
You'll have to keep the previous cursorMark available client side - meaning that it has to be a part of the URL request going forward, so you're able to move back to the previous cursorMarks (for example through a previousMark=foobar
URL argument) if necessary.
Keeping a previousCursorMark available on the Solr side would require fetching at least twice as many documents from each server, so I guess that's the reason why only the nextCursorMark is included (since you can cache the previous cursor marks yourself if you need that functionality).