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

Uwe Schindler commented on LUCENE-7416:
---------------------------------------

bq. I suspect the change is safe for master branch but requires more work if we 
want it to not break scoring with stuff like coord() at play. Additionally 
given the optimization is fairly complicated, maybe we can have a few targeted 
tests if we really want to push it to 6.x, that would help alleviate some 
concerns.

+1 I had the same issues in mind with 6.x (coord factor), although filter 
clauses should not affect coord at all - maybe another bug

I'd also like to see special targeted tests on those complicated scoring 
differences. In general the patch is fine:
- The part that return MatchNoDocs is safe, because it does not affect score at 
all (no results). It is just a bit of "set" logic, although I have the feeling 
the whole thing might be easier with Java 8 streams, because no coping of sets 
is needed - you just use a simple lambda/method reference expression to find 
the set's overlap
- The tricky part is the other optimization. I'd would like to see more 
thorough tests here!

Should I rewrite the first part to a stream/lambda?

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