lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael McCandless <>
Subject Re: How to get Total Result count using searchAfter approach
Date Fri, 18 Oct 2013 00:48:45 GMT
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

On Thu, Oct 17, 2013 at 6:16 PM,  <> 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:
> For important disclosures, please see: 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
> _______________________________________________

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message