You can still use TopDocs.totalHits from searchAfter; that will be correct.

Providing "Last" with searchAfter is not really possible; it's also
somewhat strange (does anybody really use that?).  Maybe you could
reverse your sort, take page 1, reverse its hits?

Mike McCandless

http://blog.mikemccandless.com


On Thu, Oct 17, 2013 at 6:16 PM,  <raghavendra.k....@barclays.com> wrote:
> Hi,
>
> In my current implementation of Lucene 4.3 where there are millions of 
> indexed records, I do a regular search() and get the topDocs.totalHits as the 
> count of results.
>
> As part of this, I store all the results in the session and then let the user 
> paginate through the results. With this, I am able to show the "First" 
> "Previous" "Next" and "Last" links for navigation along with the "Page 1 of 
> 500" display.
>
> Obviously, this led to memory issues and I have now decided to use the 
> searchAfter() method and hence avoid storing the huge result set in memory.
>
> Question 1: How can I get the total result count in this case? Is it even 
> possible as I won't be getting the entire resultset?
>
> Question 2: I know I can provide the "Previous" and "Next" options for 
> paginating, but is there anyway I can still provide the "Last" page option, 
> as to do that I would need to provide the document object just before the 
> last page begins.
>
> Please suggest.
>
> Regards,
> Raghu
>
>
> _______________________________________________
>
> This message is for information purposes only, it is not a recommendation, 
> advice, offer or solicitation to buy or sell a product or service nor an 
> official confirmation of any transaction. It is directed at persons who are 
> professionals and is not intended for retail customer use. Intended for 
> recipient only. This message is subject to the terms at: 
> www.barclays.com/emaildisclaimer.
>
> For important disclosures, please see: 
> www.barclays.com/salesandtradingdisclaimer regarding market commentary from 
> Barclays Sales and/or Trading, who are active market participants; and in 
> respect of Barclays Research, including disclosures relating to specific 
> issuers, please see http://publicresearch.barclays.com.
>
> _______________________________________________

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-user-h...@lucene.apache.org

Reply via email to