lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Konstantyn Smirnov <inject...@yahoo.com>
Subject RE: Reusing a CachingWrapperFilter
Date Mon, 25 Jul 2011 14:16:27 GMT

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-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message