You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Tim Mahy <ti...@infosupport.com> on 2008/05/21 11:35:25 UTC

Fetching the first 10 results and the last result

Hi all,

is there a way to let Solr not only return the total number of found articles, but also the data of the last document when for example only requesting the first 10 documents ?

we could do this with a seperate query by either letting the second query fetch 1 row from position = previouscount - 1 or by switching the sorting and fetch only the first row, but it would be nicer if we didn't have to do this second query, so is there any solution to our problem ?

greetings and thanks in advance,
Tim




Please see our disclaimer, http://www.infosupport.be/Pages/Disclaimer.aspx 

Re: Fetching the first 10 results and the last result

Posted by Mike Klaas <mi...@gmail.com>.
On 21-May-08, at 2:35 AM, Tim Mahy wrote:

> Hi all,
>
> is there a way to let Solr not only return the total number of found  
> articles, but also the data of the last document when for example  
> only requesting the first 10 documents ?
>
> we could do this with a seperate query by either letting the second  
> query fetch 1 row from position = previouscount - 1 or by switching  
> the sorting and fetch only the first row, but it would be nicer if  
> we didn't have to do this second query, so is there any solution to  
> our problem ?

There is no built-in solution; fetching only the 10th result from the  
list is a rare requirement.

You could make a custom request handler that accomplishes what you  
seek, but it is probably easiest to fetch all 10 docs and ignore docs  
1-9.

-Mike