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 <klaus.tel...@gmx.net> 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-unsubscr...@lucene.apache.org
> For additional commands, e-mail: java-user-h...@lucene.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-user-h...@lucene.apache.org

Reply via email to