My guess is that it would depend on the number of docs in the index,
how many match, how complex your query is, probably other things.
If q is complex the MatchAllDocs variant might be well be quicker but
if q is simple I wouldn't like to guess. I'm not sure there is any
point in passing the fil
If I define a query and filter like this:
Query q = new BooleanQuery()
// populating q
Filter filter = new CachingWrapperFilter( new QueryWrapperFilter( q ) )
given that I don't need score and I do need a cached filter to reuse it
immediately for other calculations, which way of searching would
-28213 Bremen
http://www.thetaphi.de
eMail: u...@thetaphi.de
> -Original Message-
> From: Konstantyn Smirnov [mailto:inject...@yahoo.com]
> Sent: Monday, July 25, 2011 4:16 PM
> To: java-user@lucene.apache.org
> Subject: RE: Reusing a CachingWrapperFilter
>
>
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
The problem with your code is , that the IndexSearcher.search() method works
per segment, but in your cardinality code you are using top-level-readers,
so it will cache two times (once per segments and once for the top-level
MultiReader/DirectoryReader). Also not all DocIdSet implementations extend