The problem is that if you want only docs 200-250, how do you know whether any particular doc will wind up in in positions 0-199? You process a doc and find it's score is X. That has no relation to the score of the _next_ doc you score. Or the previous one for that matter. So to find the doc in the 200th position, you must keep docs 0-199 around. Which means you _really_ need to sort docs 0-250 and then throw away docs 0-199.
"Deep paging" support has recently been added to Solr, see: SOLR-5463 Best, Erick On Mon, Feb 2, 2015 at 4:29 PM, Markus Jelsma <markus.jel...@openindex.io> wrote: > From memory: there are different methods in SolrIndexSearcher for reason. > It has to do with paging and sorting. Whenever you sort on a simple field, > you can easily start at a specific offset. The problem with sorting on > score, is that score has to be calculated for all documents matching query. > This means that deep paging is a problem, which it is. > > -----Original message----- > > From:Biyyala, Shishir (Contractor) <shishir_biyy...@cable.comcast.com> > > Sent: Monday 2nd February 2015 22:22 > > To: solr-user@lucene.apache.org > > Cc: java-u...@lucene.apache.org > > Subject: Question regarding SolrIndexSearcher implementation > > > > Hello, > > > > I did not know what the right mailing list would be (java-user vs > solr-user), so mailing both. > > > > My group uses solr/lucene, and we have custom collectors. > > > > I stumbled upon the implementation of SolrIndexSearcher.java and saw > this : > > > > > https://github.com/apache/lucene-solr/blob/trunk/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java > (line 1676) > > > > " TopDocs topDocs = topCollector.topDocs(0, len);" the topDocs "start" > value is always being hardcoded to 0; > > > > What that is leading to is creating of excessive topDocs that the > application actually needs; My application can potentially be faced with > deep pagination and we do not use queryresults cache. > > > > If I request for 200-250 docs, > > > > I was expecting start=199, howMany=51; > > But turns out that start=0 (always) and howMany=250 > > > > Any reasons why start value is hardcoded to 0? Please suggest. It is > potentially impacting performance of our application. > > > > Thanks much, > > Shishir >