Uwe Schindler wrote:
> 
> To just count the results use TotalHitCountCollector (since Lucene Core
> 3.1)
> with IndexSaercher.search().
> 
ok, thanks for that!

so the code should look like:

CachingWrapperFilter cwf = new CachingWrapperFilter( filter )

searcher.search( query, cwf ... ) // search 1st time, to populate cache

for( cat in categories ){
  TotalHitCountCollector thcc = new TotalHitCountCollector()
  searcher.search new TermQuery( new Term( 'category', cat ) ), cwf, thcc
  long freq = thcc.totalHits
}

TotalHitCountCollector doesn't calculate the score, does it?
Can I reuse the thcc instance in the loop?

TIA

--
View this message in context: 
http://lucene.472066.n3.nabble.com/Reusing-a-CachingWrapperFilter-tp3196928p3197593.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
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