lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <raghavendra.k....@barclays.com>
Subject How to get Total Result count using searchAfter approach
Date Thu, 17 Oct 2013 22:16:25 GMT
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.

_______________________________________________

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message