Return-Path: Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: (qmail 86738 invoked from network); 19 Jun 2009 13:22:22 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 19 Jun 2009 13:22:22 -0000 Received: (qmail 34534 invoked by uid 500); 19 Jun 2009 13:22:31 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 34500 invoked by uid 500); 19 Jun 2009 13:22: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 34490 invoked by uid 99); 19 Jun 2009 13:22:31 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 19 Jun 2009 13:22:31 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of galaio.silva@gmail.com designates 209.85.218.227 as permitted sender) Received: from [209.85.218.227] (HELO mail-bw0-f227.google.com) (209.85.218.227) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 19 Jun 2009 13:22:21 +0000 Received: by bwz27 with SMTP id 27so1863316bwz.5 for ; Fri, 19 Jun 2009 06:21:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=1sErATWQMHliCTgByj1gLYGBtIYKSvW8gpO8P/mFHI8=; b=kwOt4l0K9bkovH1qCDsJfG8N1ybmvlGzMUjn9X8yebPlYP6VbqCzA8Havii+IG+DrJ 5s/Apj7nxg5USK1b8NeVKZ+mL3Omvm7r13//d2HeHDtIjuWcfLJCusAynsGCjLWgSh1Q QQxlN+T7yDQV0Q3kvslHxvv3pdjJPqxOX5fyc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=eE8w5Bw4iuOyIQwKzQKPBhEFaeyMKGXH3Uj+VbUbM2mqbtotcUHTC9RwFtImzUjC7V jEOqhHFVDHN3Y4Dgwp+ESdW5Kn5vISyyd/VoZKFDHgf+Wh4QwPaeB1T6nIPcN/Y48/lG sUL3/klGsL80GQv/TZ5f9vUcLUt4h9r4mFwCU= MIME-Version: 1.0 Received: by 10.223.108.140 with SMTP id f12mr2258794fap.69.1245417719551; Fri, 19 Jun 2009 06:21:59 -0700 (PDT) In-Reply-To: <526786C231244E86850B3E93FA1BCB20@VEGA> References: <9C522819695C4CD2A7781CC0B9365810@VEGA> <526786C231244E86850B3E93FA1BCB20@VEGA> Date: Fri, 19 Jun 2009 14:21:59 +0100 Message-ID: Subject: Re: Collector Pagination From: =?ISO-8859-1?Q?Jo=E3o_Silva?= To: java-user@lucene.apache.org Content-Type: multipart/alternative; boundary=001636c5acf8c55845046cb368ed X-Virus-Checked: Checked by ClamAV on apache.org --001636c5acf8c55845046cb368ed Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Nice Uwe, i'll try this. Thanks, Galaio On Fri, Jun 19, 2009 at 1:33 PM, Uwe Schindler wrote: > To get the second page, > Take: > int hitsPerPage =3D 10; > int pageOffset =3D 10; > TopDocCollector collector =3D new TopDocCollector(hitsPerPage + pageOffse= t); > > For page third page take int pageOffset =3D 20; and so on > > After that your results are in hits[], for the first page in [0] to [9], > the > second page in [10] to [19] and so on: > > To display use something like: > For (int i=3DpageOffset; Math.min(hitsPerPage + pageOffset, > collector.topDocs().totalhits); i++) > > In general, you cannot retrieve a range directly, you can only retrieve t= he > top docs. As most people will not go beyond say page 10 when searching, y= ou > have no memory problem, as scoreDocs will contain at most 100 doc ids. > > Uwe > > ----- > Uwe Schindler > H.-H.-Meier-Allee 63, D-28213 Bremen > http://www.thetaphi.de > eMail: uwe@thetaphi.de > > > -----Original Message----- > > From: Jo=E3o Silva [mailto:galaio.silva@gmail.com] > > Sent: Friday, June 19, 2009 2:17 PM > > To: java-user@lucene.apache.org > > Subject: Re: Collector Pagination > > > > well, > > > > i have somthing like that: > > > > int hitsPerPage =3D 10; > > IndexSearcher searcher =3D new IndexSearcher(this.indexPath= ); > > TopDocCollector collector =3D new TopDocCollector(hitsPerPa= ge); > > Query query =3D new QueryParser("", > > this.analizer).parse(DocumentRepositoryEntry.Fields.ID.toString() + ":" > > + id); > > searcher.search(query, collector); > > > > ScoreDoc[] hits =3D collector.topDocs().scoreDocs; > > > > i know that the colector have all docs in the query, how do i navigate > > between the next pages? > > > > > > thanks, > > Galaio > > > > > > > > On Fri, Jun 19, 2009 at 12:57 PM, Jo=E3o Silva > > wrote: > > > > > Thanks Uwe, I will see that. > > > > > > Galaio > > > > > > > > > > > > > > > On Fri, Jun 19, 2009 at 12:36 PM, Uwe Schindler > wrote: > > > > > >> Hallo, > > >> > > >> Just retrieve the TopDocs for the first n documents, where n =3D > > >> offset+count, > > >> where offset is the first hit on the page (0-based) and count the > > number > > >> per > > >> page. > > >> To display the results you would then just start at offset in TopDoc= s > > and > > >> retrieve the stored field from there to offset+count. > > >> > > >> Uwe > > >> > > >> ----- > > >> Uwe Schindler > > >> H.-H.-Meier-Allee 63, D-28213 Bremen > > >> http://www.thetaphi.de > > >> eMail: uwe@thetaphi.de > > >> > > >> > > >> > -----Original Message----- > > >> > From: Jo=E3o Silva [mailto:galaio.silva@gmail.com] > > >> > Sent: Friday, June 19, 2009 12:58 PM > > >> > To: java-user@lucene.apache.org > > >> > Subject: Collector Pagination > > >> > > > >> > Hi, > > >> > is there any api form of Hits pagination? > > >> > for example, if i want to retreve the hits between > > >> > an interval. > > >> > > > >> > -- > > >> > Cumprimentos, > > >> > Jo=E3o Carlos Galaio da Silva > > >> > > >> > > >> --------------------------------------------------------------------= - > > >> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org > > >> For additional commands, e-mail: java-user-help@lucene.apache.org > > >> > > >> > > > > > > > > > -- > > > Cumprimentos, > > > Jo=E3o Carlos Galaio da Silva > > > > > > > > > > > -- > > Cumprimentos, > > Jo=E3o Carlos Galaio da Silva > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org > For additional commands, e-mail: java-user-help@lucene.apache.org > > --=20 Cumprimentos, Jo=E3o Carlos Galaio da Silva --001636c5acf8c55845046cb368ed--