Hi,

In our web app, when displaying result lists from solr,  we've successfully 
introduced paging via the params 'start' and 'rows' and it's working quite well.

Our navigation in list screens look like this:


<< First   < Prev   1 - 15 of 62181   Next 
><http://test.litterare.local:3100/littera/libraries/2/cat/man?locale=en>   
Last >><http://test.litterare.local:3100/littera/libraries/2/cat/man?locale=en>

One can navigate to the first page, previous page, next page and last page. All 
is done via adapting the param "start" accordingly by simply adding the page 
size.

However, now we want to introduce a similar navigation in our detail views, 
where only ever one document is displayed. Again, the navigation bar looks like 
this:

<< First   < Prev   1 - 15 of 62181   Next 
><http://test.litterare.local:3100/littera/libraries/2/cat/man?locale=en>   
Last >><http://test.litterare.local:3100/littera/libraries/2/cat/man?locale=en>

But now, Prev / Next shall open up the previous / next _document_ instead of 
the next page. The same goes for First and Last, it shall open the first / last 
_document_ not the page.

Our first approach to this was to simply add the param "fl=id" so we only get 
the IDs of documents and set page size to ALL (i.e. no restriction on param 
"rows"). That way, it was easy to extract the current document id from the 
result list, and check which id was preceding and succeeding the current id, as 
well as getting the very first id and the very last id, in order to render the 
navigation bar.

This lead to solr being heavily under load since it must load 62181 documents 
(in this example) in order to return the ids. I somehow thought this would be 
easy for solr to do, but it isn't.

Our second approach was, to simply keep the same value for params "start" and 
"rows" since the user is always selecting a document from the list - thus the 
selected document already is within the page. However, the edge cases are, the 
selected document is the very first on the page or the very last one, thus the 
previous or next document id is not within the page result from solr -> I guess 
this we could handle by simply checking and sending a second query where the 
param "start" would be adjusted accordingly.

However I would not know how to retrieve the id of the very first document and 
the very last document (except for executing separate queries with I guess 
start=0, rows=1 and start=62181 and rows=1)

TL,DR:
For any query and a documentId (of which it is known it is within the query 
result), what is a simple and efficient enough way, to get the following 
navigational information:

-          Previous document Id

-          Next document id

-          First document id

-          Last document id

Can this sort of requirement be handled within one solr query? Should I user 
cursorMark in this scenario?

Best regards,

Sebastian

Reply via email to