-
-
Notifications
You must be signed in to change notification settings - Fork 721
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lift clauses in LogicalAst #2449
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it works for all Occur
// If clauses below have the same `Occur`, we can pull them up | ||
match simplified_sub_ast { | ||
LogicalAst::Clause(sub_clauses) | ||
if sub_clauses.iter().all(|(o, _)| *o == occur) => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if Occur is Not?
Can we stay on the safe side and only apply this logic for occur = Must, Should, or Filter?
Also this will only yield the same score if we sum scores of child branches.
(I think this is the case today: we don't rely on dismax do we?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes good catch, I excluded it and added a test. There are more optimization we can do here to flatten clauses later on
(a OR b) OR (c OR d) can be simplified to (a OR b OR c OR d) (a AND b) AND (c AND d) can be simplified to (a AND b AND c AND d) This directly affects how queries are executed remove unused SumWithCoordsCombiner the number of fields is unused and private
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe other simplifications are possible (see below), this one seems correct
- top: Should, inner: single Must => Should
- top: Must, inner: single Should => Must
top: MustNot, inner: all MustNot => all Shouldimpact scoring (or we need to wrap with a boost of 0)- top: MustNot, inner: single Must|Should => MustNot
- top: Must, inner: all MustNot => all MustNot
@trinity-1686a Can you open a ticket and auto-assign for this? |
(a OR b) OR (c OR d) can be simplified to (a OR b OR c OR d) (a AND b) AND (c AND d) can be simplified to (a AND b AND c AND d) This directly affects how queries are executed remove unused SumWithCoordsCombiner the number of fields is unused and private
(a OR b) OR (c OR d) can be simplified to (a OR b OR c OR d)
(a AND b) AND (c AND d) can be simplified to (a AND b AND c AND d)
This directly affects how queries are executed and the performance
Remove
SumWithCoordsCombiner
, it is effectively the same asSumCombiner
, but with an unused field