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 filter to the ConstantScore variation. An alternative might be to use the filter directly via it's DocIdSet. Whatever you do, searching is generally very quick. Reading doc values, formatting, whatever, is often what takes the time. -- Ian. On Fri, Jul 29, 2011 at 3:08 PM, Konstantyn Smirnov <inject...@yahoo.com> wrote: > 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 be the most > performing: > > searcher.search( new MatchAllDocsQuery(), filter, max ) > > or > > searcher.search( new ConstantScoreQuery( q ), filter, max ) > > or > > something completely different? > > TIA > > -- --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org