You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Fix regression: preserve not(not X) in BooleanFlatteningRewriter Resolveopensearch-project#19266 by fixing double-negation under MUST_NOT introduced by opensearch-project#19060 When parent is must_not and nested bool has only must_not clauses, rewrite to a positive OR:
not(bool(must_not:[X1..Xn])) => filter(bool(should:[X1..Xn], minimum_should_match=1))
Use FILTER (not MUST) to preserve non-scoring semantics of must_not
Leave other flattenings unchanged; only trigger on pure must_not nested bool
Add unit test: testDoubleNegationConvertedToPositiveMustShould
Signed-off-by: Atri Sharma <[email protected]>
* spotless output
Signed-off-by: Atri Sharma <[email protected]>
* Remove must_not rewrite
Signed-off-by: Atri Sharma <[email protected]>
* Query rewriting tests: expand coverage; enforce idempotence and non-flattening invariants
This change broadens the test suite for query rewriting to codify semantics, guard against regressions, and address maintainer feedback around non‑idempotent must_not handling.
BooleanFlatteningRewriterTests:
Add explicit “don’t flatten” cases when nested bool has non-default boost, has queryName, or nested should has minimum_should_match.
Add idempotence check (second rewrite is a no-op in structure/serialization).
MatchAllRemovalRewriterTests:
Remove match_all from must when a non-scoring context (filter) is present.
Remove deeply nested match_all under filter-in-filter.
MustToFilterRewriterTests:
Move boosted numeric term/range queries to filter; ensure text queries remain scoring.
With null QueryShardContext, move ranges but do not move numeric term/terms.
MustNotToShouldRewriterTests:
Add idempotence check.
Ensure no rewrite for multi-valued numeric fields (complements must_not disabled).
TermsMergingRewriterTests:
Should-clause merging above threshold.
Per-field merging: only coalesce within the same field; mixed fields remain separate.
QueryRewriterRegistryTests:
Dynamic setting update for terms merging threshold (e.g., 16 → 32) changes behavior as expected.
Registry idempotence: applying rewrite twice yields identical structure.
Signed-off-by: Atri Sharma <[email protected]>
---------
Signed-off-by: Atri Sharma <[email protected]>
Signed-off-by: Ankit Jain <[email protected]>
0 commit comments