Return-Path: X-Original-To: apmail-lucene-java-user-archive@www.apache.org Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id F1AC4108FA for ; Fri, 18 Oct 2013 00:49:33 +0000 (UTC) Received: (qmail 51241 invoked by uid 500); 18 Oct 2013 00:49:31 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 51191 invoked by uid 500); 18 Oct 2013 00:49:31 -0000 Mailing-List: contact java-user-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-user@lucene.apache.org Delivered-To: mailing list java-user@lucene.apache.org Received: (qmail 51183 invoked by uid 99); 18 Oct 2013 00:49:31 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 18 Oct 2013 00:49:31 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy includes SPF record at spf.trusted-forwarder.org) Received: from [209.85.220.175] (HELO mail-vc0-f175.google.com) (209.85.220.175) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 18 Oct 2013 00:49:27 +0000 Received: by mail-vc0-f175.google.com with SMTP id ia6so81139vcb.34 for ; Thu, 17 Oct 2013 17:49:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:content-type:content-transfer-encoding; bh=SLzPofvcjBCZ9+NfmWopPjbeJd7m2pcmu9kQnb9rJ9Y=; b=Qpnc8X5Nnt5K4sC91mHA5iNHxfhudoy2G+Hz9Ke1//peITpb/QWQCQ24uz+6u6i2gE 3Ml7p70F1SK2NX93diztDP0E6pYxISklgckT00N/NpWuTRTlgwAMOf3nk8LHDiPpy5Ld 3Ev/A8jqivIM1dbHE8GFlPWJ4I4FtoxJOaZ4VEzhrO7hmKS/SXYDEs26wLrxC0NWGiWE RjRFr0lGrDXYOvJaeT3C6NI/lSQTsE56kpnKkOxBW19iOfgdNrAfZq6RFZ5lmy2jKS5f 8MSoecHRRRuUFRfYddKjGOgrjCdrBDnx7kWUizaEgzoqVuQlooU8XSVteBdnqeHrdLTT Q3tw== X-Gm-Message-State: ALoCoQnu8WN6LTYXYuVIk5LoTgn6maSVL/MXOCKDqfv0RfMlaJnqy8lYX2y6mNkojU8jHDZdT46x X-Received: by 10.52.119.228 with SMTP id kx4mr69907vdb.12.1382057345481; Thu, 17 Oct 2013 17:49:05 -0700 (PDT) MIME-Version: 1.0 Received: by 10.220.72.131 with HTTP; Thu, 17 Oct 2013 17:48:45 -0700 (PDT) In-Reply-To: References: From: Michael McCandless Date: Thu, 17 Oct 2013 20:48:45 -0400 Message-ID: Subject: Re: How to get Total Result count using searchAfter approach To: Lucene Users Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org 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, wrote: > Hi, > > In my current implementation of Lucene 4.3 where there are millions of in= dexed 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 o= f 500" display. > > Obviously, this led to memory issues and I have now decided to use the se= archAfter() 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 pa= ginating, but is there anyway I can still provide the "Last" page option, a= s to do that I would need to provide the document object just before the la= st 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 re= cipient only. This message is subject to the terms at: www.barclays.com/ema= ildisclaimer. > > For important disclosures, please see: www.barclays.com/salesandtradingdi= sclaimer regarding market commentary from Barclays Sales and/or Trading, wh= o are active market participants; and in respect of Barclays Research, incl= uding disclosures relating to specific issuers, please see http://publicres= earch.barclays.com. > > _______________________________________________ --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org For additional commands, e-mail: java-user-help@lucene.apache.org