: Is there any possible way to get the results back from Solr in the reverse
: order they were indexed (i.e.  the documents that was most recently added
: should be the first in the result)
: 
: I know I can add a indexedAt=NOW field of type date and sort on it in desc
: order.
: 
: But if I have a paginated web application giving 10 results each time, every
: time user goes to the next page, Solr has to re-evaluate all the results,
: sort the whole data set on date and return the 10 documents relevant. Which
: I think is a lot of overhead. 

the overhead you are speculating about is largely imagined .. it can be 
problematic if you have users going to the 10000th page, but for normal 
user traffic you aren't going to see any problems with the computational 
effort of loading "page two"  (if you use the example solr configs, and 
display 10 results per page, solr will automaticly cache pages 1-5 for you 
when page #1 is requested -- see the queryResultWindowSize for details)

If you don't want to use a specific indexedAt field, you can use 
"sort=_docid_ desc" but it's not 100% garunteed to be "reverse the order 
added" if you use a MergePolicy that re-orderes segments.  (and even this 
will have the same imaginary overhead for loading page #2, 3, 4, etc... as 
if you sort o na field -- all this type of approach saves you is the 
overhead of the FieldCache)

https://wiki.apache.org/solr/CommonQueryParameters#sort

-Hoss

Reply via email to