Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Lucene: Java-User

fast Result Count

 

 

Lucene java-user RSS feed   Index | Next | Previous | View Threaded


klaus.teller at gmx

Feb 9, 2010, 8:44 AM

Post #1 of 3 (605 views)
Permalink
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 [at] lucene
For additional commands, e-mail: java-user-help [at] lucene


erickerickson at gmail

Feb 9, 2010, 9:41 AM

Post #2 of 3 (580 views)
Permalink
Re: fast Result Count [In reply to]

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 <klaus.teller [at] gmx> 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 [at] lucene
> For additional commands, e-mail: java-user-help [at] lucene
>
>


ian.lea at gmail

Feb 9, 2010, 10:04 AM

Post #3 of 3 (583 views)
Permalink
Re: fast Result Count [In reply to]

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.teller [at] gmx> 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 [at] lucene
> For additional commands, e-mail: java-user-help [at] lucene
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe [at] lucene
For additional commands, e-mail: java-user-help [at] lucene

Lucene java-user RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.