On Friday 26 October 2007 09:36:58 Ard Schrijvers wrote: > Hello, > > I am seeing that a query with boolean queries in boolean queries takes > much longer than just a single boolean query when the number of hits if > fairly large. For example > > +prop1:a +prop2:b +prop3:c +prop4:d +prop5:e > > is much faster than > > (+(+(+(+prop1:a +prop2:b) +prop3:c) +prop4:d) +prop5:e) > > where the second one is a result from BooleanQuery in BooleanQuery, and > all have Occur.MUST. > > Is there a way to detect and rewrite the second inefficient query? > query.rewrite() does not change the query AFAICS.
SImplifying boolean queries like this is not available in Lucene, but it would have a positive effect on search performance, especially when prop1:a and prop2:b have a high document frequency. You could write this yourself, for example by overriding BooleanQuery.rewrite(). Take care about query weights, though. Regards, Paul Elschot > > thanks for any help, > > Regards Ard --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]