Hi Anton, Thanks for reporting this. It is indeed a bit surprising given that both classes work in a very similar way. Can you confirm that the response times that you are reporting both happen on Lucene 5.2 (even with CachingWrapperFilter) and on a "hot cache" (so that they don't include the generation of the cache entries)?
Could you also provide us with the following information: - what are the response times without caching? - how many docs do you have in the index? - how many documents does the cached filter match? - how many documents do your two popular queries match? If you have the opportunity to perform some profiling of your query execution, this might be useful as well. Thanks! On Mon, Jun 15, 2015 at 10:56 AM, Anton Lyska <profondome...@gmail.com> wrote: > Hi, > > I have performance issues with CachingWrapperQuery with lucene 5.2 and > dont know how to solve it. > > Prehistory: > I have search with different parameters, where some parameters are used > more frequently then others. For these params I used filters(and cached > them), and my search looked like this > > BooleanFilter bf = new BooleanFilter (); > bf.add(.., BooleanClause.Occur.MUST); //frequently used params here > bf.add(.., BooleanClause.Occur.MUST); > > Filter searchFilter = new CachingWrapperFilter(bf); //and this > filter object was reused between queries > > BooleanQuery searchQuery = new BooleanQuery(); > searchQuery.add(.., BooleanClause.Occur.MUST); > searchQuery.add(.., BooleanClause.Occur.MUST); > > hits = searcher.search(searchQuery, searchFilter, count, sort); > > And everything were great. I looked at two popular queries and each took 32 > ms and 22 ms to execute. > > Now I did upgrade Lucene to 5.2 (from 5.0), and saw that filters are > deprecated and its advisable to use queries and CachingWrapperQuery. > > So i changed sources to this: > > > BooleanQuery bq = new BooleanQuery (); //now it becomes BooleanQuery > bq.add(.., BooleanClause.Occur.MUST); //frequently used params here, > same terms as before > bq.add(.., BooleanClause.Occur.MUST); > > Query cachedQuery = new CachingWrapperQuery(bq); //this object is > reused between queries > > BooleanQuery searchQuery = new BooleanQuery(); > searchQuery.add(.., BooleanClause.Occur.MUST); > searchQuery.add(.., BooleanClause.Occur.MUST); > searchQuery.add(cachedQuery, BooleanClause.Occur.FILTER); //here i > add cached part of the query > > hits = searcher.search(searchQuery, count, sort); > > Later I looked at same queries, and they took 145ms and 95ms to execute! > > Moving to CachingWrapperQuery was the only difference between queries, so > question is: > How to use CachingWrapperQuery right in my situation, or should I switch > back to filters? -- Adrien --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org