Return-Path: Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: (qmail 49944 invoked from network); 16 Sep 2008 03:26:25 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 16 Sep 2008 03:26:25 -0000 Received: (qmail 23917 invoked by uid 500); 16 Sep 2008 03:26:17 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 22880 invoked by uid 500); 16 Sep 2008 03:26:14 -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 22869 invoked by uid 99); 16 Sep 2008 03:26:14 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 15 Sep 2008 20:26:14 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of cambazz@gmail.com designates 209.85.198.225 as permitted sender) Received: from [209.85.198.225] (HELO rv-out-0506.google.com) (209.85.198.225) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 16 Sep 2008 03:25:16 +0000 Received: by rv-out-0506.google.com with SMTP id f6so2302016rvb.5 for ; Mon, 15 Sep 2008 20:25:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=vyFbrPe+/FmpcjCnUREZY0tMKyBOxJPvAw1PSjdTmFE=; b=Uez+AjoSWQPiedE/DcdF3e6RhcBilLVuh2KU9uRGhc6JjUSi2VQeGjYz06dbfKSevQ ahhncTnrh2hZl1ygZ54weiTXAqryAOnyKGIgrExlnk9g5apg+aNXoR46AweIfrbwa6Uy mjokDTnZhm5S1vsFZZusb2GnoLGwUF8jIwH7Q= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=bjxsmEBSZ1CWtBT8XYSIwFtw7g8W1s49M4M8eExy/GM1LalRg/K/V18r83p7V2l3CO 6w1NCcVt79cVrrd1x8t8zyQwBZgLQ3b0pSYb2I+5BZR+VHVqePnKyE0PW7qwW7/Y19GQ jYOSDIc98mYybXO3+bueHwLuz0kQ4d5UGJits= Received: by 10.141.15.19 with SMTP id s19mr5326438rvi.205.1221535539214; Mon, 15 Sep 2008 20:25:39 -0700 (PDT) Received: by 10.141.176.5 with HTTP; Mon, 15 Sep 2008 20:25:39 -0700 (PDT) Message-ID: <1bcb7c7f0809152025i6343e6a6nc4e902a03a0e8c62@mail.gmail.com> Date: Tue, 16 Sep 2008 06:25:39 +0300 From: "Cam Bazz" To: java-user@lucene.apache.org Subject: Re: TopDocs question In-Reply-To: <48CF227E.2060906@nuix.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <1bcb7c7f0809151942gf79d8d0s97b0b5301e1cb433@mail.gmail.com> <48CF227E.2060906@nuix.com> X-Virus-Checked: Checked by ClamAV on apache.org Yes, I looked into implementing a custom collector that would return number of hits, but - I could not. collect() can not access anything that is final, and final can not be incremented. Any ideas? Best. On Tue, Sep 16, 2008 at 6:05 AM, Daniel Noll wrote: > Cam Bazz wrote: >> >> Hello, >> >> Could it harm if I make a >> >> searcher.search(query, Integer.MAX_VALUE) ? >> >> I just need to make a query to get the number of hits in this case, >> but I dont know what the max hits will be. > > PriorityQueue will attempt to allocate an array of that size. > > But if you only need to know the *number* of hits, and don't need the hits > themselves, then you should just use a custom HitCollector which increments > a counter. It will run much faster. > > Daniel > > > -- > Daniel Noll > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org > For additional commands, e-mail: java-user-help@lucene.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org For additional commands, e-mail: java-user-help@lucene.apache.org