You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Klaus Teller <kl...@gmx.net> on 2010/02/09 17:44:55 UTC
fast Result Count
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
Re: fast Result Count
Posted by Erick Erickson <er...@gmail.com>.
I'm not sure what you mean by "loading them all into memory".
I'm pretty sure that the numHits you specify just limits the number
of documents kept in the internal ScoreDocs, and getTotalHits
can easily be much greater than numHits. But that would be
trivial to test (you shouldn't take my word for this one <G>)...
HTH
Erick
On Tue, Feb 9, 2010 at 11:44 AM, Klaus Teller <kl...@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-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>
Re: fast Result Count
Posted by Ian Lea <ia...@gmail.com>.
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 <kl...@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-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