Return-Path: Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: (qmail 41203 invoked from network); 16 Mar 2009 20:08:31 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 16 Mar 2009 20:08:31 -0000 Received: (qmail 16267 invoked by uid 500); 16 Mar 2009 20:08:23 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 15961 invoked by uid 500); 16 Mar 2009 20:08:21 -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 15907 invoked by uid 99); 16 Mar 2009 20:08:20 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 16 Mar 2009 13:08:20 -0700 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 (nike.apache.org: domain of aminmc@gmail.com designates 209.85.219.157 as permitted sender) Received: from [209.85.219.157] (HELO mail-ew0-f157.google.com) (209.85.219.157) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 16 Mar 2009 20:08:11 +0000 Received: by ewy1 with SMTP id 1so2005467ewy.5 for ; Mon, 16 Mar 2009 13:07:51 -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=1NxEX84Bvxj1yHNxCqHWAXdl20HIKnxB10aPOOI8QiY=; b=SL8/euI03Jin/0aFWZGXjL25OAVfWLbxKCBp5AF5cKc5hqbjZn6iqZeXKgcTGeN8lk 3Iou/B5xB6BryAivSns51eRUAEmgyTbfmavBSYYyRpYfd005X/SvYyH0tayKlhuPMono QQ2eKlkl/lU5MOcPRaDwPON2cR811/EKESq9Q= 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=HLsQ3+r177MtF6sBEA1PBRiCDzZJF+hrPU2IXBKvMGvbKgd/UzKdE80UkZm0b5zZUX /fgCJLW6TQCCPlgX1HqzonVQkJiexmW08iTYTK9Khp3db6s/oDLz9QAhcDRCO0l617V5 IE9eYcXN3Uiu1qH9hjKvUrYoxmyolssXELNck= MIME-Version: 1.0 Received: by 10.216.28.208 with SMTP id g58mr1939089wea.11.1237234071313; Mon, 16 Mar 2009 13:07:51 -0700 (PDT) In-Reply-To: <6f4104d80903160103j5c6c15a2oc1dabb3e70854749@mail.gmail.com> References: <359a92830903150608n75659e7aq64344002a04545d1@mail.gmail.com> <6f4104d80903150615u1054d82dmd8eab6408f54c39@mail.gmail.com> <359a92830903151842j691f27b6g774fd059116af3e3@mail.gmail.com> <6f4104d80903160103j5c6c15a2oc1dabb3e70854749@mail.gmail.com> Date: Mon, 16 Mar 2009 20:07:51 +0000 Message-ID: <6f4104d80903161307w315a4cd8s8af8d639af5204d3@mail.gmail.com> Subject: Re: Pagination with MultiSearcher From: Amin Mohammed-Coleman To: java-user@lucene.apache.org Content-Type: multipart/alternative; boundary=0016e6db66fa531d34046542012f X-Virus-Checked: Checked by ClamAV on apache.org --0016e6db66fa531d34046542012f Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Hi I've come across the PageHitCollector class from the: http://mail-archives.apache.org/mod_mbox/lucene-java-user/200707.mbox/%3C070320071521.6119.468A6964000B3E75000017E72205884484070A9C0701030C03@comcast.net%3E I'm looking at using this in the multisearcher class, and do: search(query,filter,pageHitCollector) I intend to use comparators to do the sorting and use collections.sort(). I would be grateful for any feedback on whether this is a good approach. Cheers Amin On Mon, Mar 16, 2009 at 8:03 AM, Amin Mohammed-Coleman wrote: > Hi Erick > > I've seen the following: > > TopDocCollector collector = new TopDocCollector(hitsPerPage) and then pass > the collector to the seacher. But I'm not sure how I increment the > hitsPerPage. Also how do I get the total results returned? > > In relation to sorting I could basically use Collections.sort(..) or > something similar. My search returns a collection of summary objects which > I could sort at that stage rather than passing it to the search code. This > would mean I could use a collector to do this. > > Cheers > Amin > > > > > On Mon, Mar 16, 2009 at 1:42 AM, Erick Erickson wrote: > >> Basically, the FileSortedHitQueue is just a sorting mechanism you >> implement yourself. But I can't help but think that there's an easier >> way, although I'll have to admit I haven't used MultiSearcher enough >> to offer much guidance..... That'll teach me to send something off >> on Sunday that I don't really understand well enough.... >> >> Sorry 'bout that >> Erick >> >> On Sun, Mar 15, 2009 at 9:15 AM, Amin Mohammed-Coleman > >wrote: >> >> > HI Erick >> > Thanks for your reply, glad to see I'm not the only person >> > working/developing on a Sunday! I'm not sure how the >> FieldSortedHitQueue >> > works and how it can be applied to the search method exposed by >> > MultiSearcher. Would it be possible to clarify abit more or even point >> to >> > some reference documentation? >> > >> > Cheers >> > Amin >> > >> > On Sun, Mar 15, 2009 at 1:08 PM, Erick Erickson < >> erickerickson@gmail.com >> > >wrote: >> > >> > > You could do something with FieldSortedHitQueue as a post-search >> > > sort, but I wonder if this would work for you... >> > > >> > > public TopFieldDocs >> > > < >> > > >> > >> http://lucene.apache.org/java/2_4_1/api/org/apache/lucene/search/TopFieldDocs.html >> > > > >> > > *search*(Query < >> > > >> > >> http://lucene.apache.org/java/2_4_1/api/org/apache/lucene/search/Query.html >> > > > >> > > query, >> > > Filter >> > > < >> > > >> > >> http://lucene.apache.org/java/2_4_1/api/org/apache/lucene/search/Filter.html >> > > > >> > > filter, >> > > int n, >> > > Sort >> > > < >> > > >> > >> http://lucene.apache.org/java/2_4_1/api/org/apache/lucene/search/Sort.html >> > > > >> > > sort) >> > > throws IOException >> > > >> > > >> > > >> > > Best >> > > Erick >> > > >> > > >> > > On Sun, Mar 15, 2009 at 2:12 AM, Amin Mohammed-Coleman < >> aminmc@gmail.com >> > > >wrote: >> > > >> > > > Hi >> > > > >> > > > I'm looking at trying to implement pagination for my search project. >> > I've >> > > > been google-ing for a solution. So far no luck. I've seen >> > implementations >> > > of >> > > > HitCollector which looks promising, however my search method has to >> > > > completely change. >> > > > >> > > > For example I'm currently using the following: >> > > > >> > > > search ( query, filter,int, sort) >> > > > >> > > > If I use a HitCollector there isn't a search to apply >> > > > query,hitcollector,sort and filter, unless I'm supposed to apply >> sort >> > and >> > > > filter in the hit collector. >> > > > >> > > > I would be grateul if anyone could advise me what approach to take. >> > > > >> > > > One a side note I just want to thank you all for helping me with >> many >> > of >> > > my >> > > > issues. I'm hoping this is my last question! Thanks for your >> patience! >> > > > >> > > > >> > > > Cheers >> > > > >> > > > Amin >> > > > >> > > > >> > > > >> --------------------------------------------------------------------- >> > > > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org >> > > > For additional commands, e-mail: java-user-help@lucene.apache.org >> > > > >> > > > >> > > >> > >> > > --0016e6db66fa531d34046542012f--