[ 
https://issues.apache.org/jira/browse/LUCENE-7416?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15437152#comment-15437152
 ] 

Adrien Grand commented on LUCENE-7416:
--------------------------------------

bq. I am concerned about us making the wrong tradeoff here and breaking common 
cases by optimizing rare cases .

I'm not sure about these rules in particular, but I know some existing rules 
are useful, such as the one that rewrites to a CSQ around the filters when the 
single MUST clause is a MatchAllDocsQuery. I think one reason why this happens 
is that apps have a fixed filter and then a configurable query that depends on 
the user and that defaults to a MatchAllDocsQuery.

I can't think of one reason why someone would put a clause both is MUST and 
MUST_NOT, or both SHOULD and FILTER but I wouldn't be surprised that this 
happens sometimes. I think the testRandom test should be quite good at finding 
cases that we did not think about, but otherwise another approach I'd be fine 
with would be to back this change out and wait until we have concrete examples 
of users building such queries before adding rewrite rules for them.

> BooleanQuery rewrite optimizations
> ----------------------------------
>
>                 Key: LUCENE-7416
>                 URL: https://issues.apache.org/jira/browse/LUCENE-7416
>             Project: Lucene - Core
>          Issue Type: Improvement
>          Components: core/search
>    Affects Versions: master (7.0)
>            Reporter: Spyros Kapnissis
>            Priority: Minor
>             Fix For: master (7.0), 6.3
>
>         Attachments: LUCENE-7146-simplific1.patch, 
> LUCENE-7146-simplific1.patch, LUCENE-7146.patch
>
>
> A couple of BooleanQuery rewrites / optimizations. 
> First, as discussed on the user group, a BooleanQuery with a query that is 
> both a SHOULD and a FILTER can be rewritten as a single MUST query, but care 
> must be taken to decrement minShouldMatch by 1.
> Another case is if a query is both required (MUST or FILTER) and MUST_NOT at 
> the same time, it can be converted to a MatchNoDocsQuery (although I haven't 
> discussed this yet so hopefully I'm not missing something!).



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to