Return-Path: Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: (qmail 20067 invoked from network); 20 Oct 2009 21:22:39 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 20 Oct 2009 21:22:39 -0000 Received: (qmail 51348 invoked by uid 500); 20 Oct 2009 21:22:37 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 51277 invoked by uid 500); 20 Oct 2009 21:22:37 -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 51267 invoked by uid 99); 20 Oct 2009 21:22:37 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 20 Oct 2009 21:22:37 +0000 X-ASF-Spam-Status: No, hits=-2.6 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of yseeley@gmail.com designates 74.125.78.24 as permitted sender) Received: from [74.125.78.24] (HELO ey-out-2122.google.com) (74.125.78.24) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 20 Oct 2009 21:22:34 +0000 Received: by ey-out-2122.google.com with SMTP id 22so1339357eye.3 for ; Tue, 20 Oct 2009 14:22:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:reply-to:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:content-type:content-transfer-encoding; bh=RDQ2KRHTjUBObs81dkrlEmz9NK0TjN99peO9qMXYHL8=; b=jAGPh1kAlV20OSkXBWZMkalvj+AkrYknGgNwWSlZxwHWFyxMotHy5VunGNyGdk5Qj9 XzAZWA7VTzg7ADoGaKBs+PL2Enu2Xhjaqjybgl+Ij6N1923l647tLUSfh2wiHsS3y1/q 6cX0oPggEUM1MfVveRdGnaJYj0rlNUBIpuysw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:reply-to:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type :content-transfer-encoding; b=MFJcY7OLow6RylCqMVFOkvj3lXDEL1fBzVO9+4BvZcAHdC/1xjaxX7wkzL6pJPZ40u DAGJ4+nlMiVRpls6hWo6yKu9b7OqWZUfvy08lmaE2cSflepjJOQaXXjwzxgF0UDV0Tc5 FnIF9VTJcDOw6h3DPMSbxm4IRMHEca60oaPcM= MIME-Version: 1.0 Sender: yseeley@gmail.com Reply-To: yonik@lucidimagination.com Received: by 10.216.85.210 with SMTP id u60mr2482787wee.226.1256073732843; Tue, 20 Oct 2009 14:22:12 -0700 (PDT) In-Reply-To: <4ad1ca1b0910201403h1397c647yb43f11d0e3d51684@mail.gmail.com> References: <4ad1ca1b0910201403h1397c647yb43f11d0e3d51684@mail.gmail.com> Date: Tue, 20 Oct 2009 17:22:12 -0400 X-Google-Sender-Auth: 8a8149204e412312 Message-ID: Subject: Re: Hits and TopDoc From: Yonik Seeley To: java-user@lucene.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On Tue, Oct 20, 2009 at 5:03 PM, Nathan Howard wrot= e: > This is sort of related to the above question, but I'm trying to update s= ome > (now depricated) Java/Lucene code that I've become aware of once we start= ed > using 2.4.1 (we were previously using 2.3.2): > > Hits results =3D MultiSearcher.search(Query)); > > int start =3D currentPage * resultsPerPage; > int stop =3D (currentPage + 1) * resultsPerPage(); > > for(int x =3D start; (x < searchResults.length()) && (x < stop); x++) > { > =A0 =A0Document doc =3D searchResults.doc(x); > =A0 =A0// do search post-processing with the Document > } > > Results per page is normally small (10ish or so). > > I'm having difficulty figuring out how to get TopDocs to replicate this > paging functionality (which the application must maintain). You do it tthe same way basically... calculate the biggest doc you need ("stop"-1 in your code), ask for that many TopDocs, and then iterate over the page you want, calling searcher.doc(topDocs.scoreDocs[x].doc) -Yonik http://www.lucidimagination.com --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org For additional commands, e-mail: java-user-help@lucene.apache.org