lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael McCandless <luc...@mikemccandless.com>
Subject Re: Query rewriting/optimization
Date Thu, 21 May 2009 18:46:13 GMT
Alas, Lucene in general does not do such structural optimization (and
I agree, we should).  EG we could do it during Query.rewrite().

There are certain corner cases that are handled, eg a BooleanQuery
with a single BooleanClause, or BooleanQuery where
minimumNumberShouldMatch exceeds the number of SHOULD clauses
immediately returns no matches, etc.

So in general if there are "interesting" functional equivalents of
your query, you should try them out.  Eg if you use filtering, you
should test adding it as a clause on BooleanQuery instead of passing
in the"Filter" arge to search (we are considering doing that
internally).

If you do some testing and learn anything interesting, please post
back!

Mike

On Thu, May 21, 2009 at 1:06 PM, Preetham Kajekar <preetham@cisco.com> wrote:
> Hi,
> I am wondering if Lucene internally rewrites/optimizes Query. I am
> programatically generating Query based on various user options, and quite
> often I have BooleanQueri'es wrapped inside BooleanQueries etc.
> Like,
> ((Src:Testing Dst:Test) (Src:Test2 Port:http)).
> In this case, would Lucene optimize to remove the unwanted BooleanQueries ?
> Or more importantly, would these extra BooleanQueries cause any performance
> problems and should I fix my code to have a better Query ?
>
> Thanks,
> ~preetham
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

---------------------------------------------------------------------
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