Re: fast Result Count

2010-02-09 Thread Ian Lea
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.

Re: fast Result Count

2010-02-09 Thread Erick Erickson
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