Return-Path: Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: (qmail 24843 invoked from network); 9 Feb 2010 18:05:29 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 9 Feb 2010 18:05:29 -0000 Received: (qmail 14872 invoked by uid 500); 9 Feb 2010 18:05:26 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 14827 invoked by uid 500); 9 Feb 2010 18:05:26 -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 14817 invoked by uid 99); 9 Feb 2010 18:05:26 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 09 Feb 2010 18:05:26 +0000 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 ian.lea@gmail.com designates 209.85.218.222 as permitted sender) Received: from [209.85.218.222] (HELO mail-bw0-f222.google.com) (209.85.218.222) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 09 Feb 2010 18:05:19 +0000 Received: by bwz22 with SMTP id 22so753662bwz.5 for ; Tue, 09 Feb 2010 10:04:58 -0800 (PST) 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 :from:date:message-id:subject:to:content-type; bh=syzrV+KqLK7RYCgC3eAlKZGIaPp2n53TBfvNomlFYUM=; b=i7h5WI8IXakulz5mCYnIOCw9WM7bVpOQcLVyfz0jxEboVPtKJzKalSn2LjYchDQI52 5i3gtqEL0ErS17sOBBSVkDZYo2G1LiwzWNQMJ89kYvR5HP/qdaHr1OwIcmt7bJCzfdNp brighIgA4gtCURmmavzBiEknRS62e9fSBJZs8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; b=GLA9OePplrFICKTJjPtx+kM6bXn58opC52o81Y/t4UqZI/k4GPuYQeLH1xdgKE9DZ6 HF95kFfbAN81YZaMyBzU6RKnopChqd0X8TvHp7YlRTfz/JYNITzK+HAFXlt1AuSOEQAT gNq1yAiYkxJyjzsk618PPY2OH3/eAIB7UVUwM= MIME-Version: 1.0 Received: by 10.204.25.197 with SMTP id a5mr3011559bkc.70.1265738698291; Tue, 09 Feb 2010 10:04:58 -0800 (PST) In-Reply-To: <20100209164455.41060@gmx.net> References: <20100209164455.41060@gmx.net> From: Ian Lea Date: Tue, 9 Feb 2010 18:04:38 +0000 Message-ID: <8c4e68611002091004i623e9ec8j328ba6f83631865f@mail.gmail.com> Subject: Re: fast Result Count To: java-user@lucene.apache.org Content-Type: text/plain; charset=ISO-8859-1 Write a simple Collector (read the javadocs) that has a collect(int doc) method that does nothing except increment a counter. Use it via one of the search methods that takes a Collector. btw TopDocCollector won't load them all in memory, but obviously it will keep track of the top scoring docs. -- Ian. On Tue, Feb 9, 2010 at 4:44 PM, Klaus Teller wrote: > Hi Guys, > > Is there a way to speed up couting documents that satisfy a search query other than by using TopDocCollector.getTotalHits()? > > For instance, if there are 1000000 documents satisfying my search query, how can I count them without loading them all in memory? > > Thanks, > Klaus. > -- > Jetzt kostenlos herunterladen: Internet Explorer 8 und Mozilla Firefox 3.5 - > sicherer, schneller und einfacher! http://portal.gmx.net/de/go/atbrowser > > --------------------------------------------------------------------- > 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