Fix group precedence in MilvusFilterExpressionConverter - #6543
Merged
ericbottard merged 1 commit intoJul 2, 2026
Merged
Conversation
The `doGroup` override converted a parenthesized filter group into
`content && content`, duplicating the group body and dropping the
parentheses that expressed the grouping. Because Milvus binds `&&`
tighter than `||`, a filter such as
(year >= 2020 OR country == 'BG') AND city != 'Sofia'
was emitted without parentheses, so the trailing `AND` no longer
applied to the whole group and the query silently matched the wrong
documents.
Replace the override with the conventional `doStartGroup`/`doEndGroup`
hooks that wrap the group content in parentheses, consistent with the
other filter expression converters such as
`PgVectorFilterExpressionConverter`. Update the affected test, which
asserted the incorrect output, and add a test covering a group used as
the right-hand operand.
Signed-off-by: Seol-JY <70826982+Seol-JY@users.noreply.github.com>
Seol-JY
force-pushed
the
fix-milvus-filter-group-precedence
branch
from
July 2, 2026 02:59
c421373 to
72c34e6
Compare
Member
|
Thanks for yet another useful contribution @Seol-JY ! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
doGroupoverride inMilvusFilterExpressionConverterconverted a parenthesized filter group intocontent && content, duplicating the group body and dropping the parentheses that expressed the grouping.Because Milvus binds
&&tighter than||, a filter such as:was emitted without parentheses:
so the trailing
ANDno longer applied to the whole group, and the query silently matched the wrong documents.This replaces the override with the conventional
doStartGroup/doEndGrouphooks that wrap the group content in parentheses, consistent with the other filter expression converters (for examplePgVectorFilterExpressionConverter) and with the baseAbstractFilterExpressionConvertercontract. Making the grouping explicit also means the result no longer relies on Milvus's operator precedence.The existing
testGroupassertion codified the incorrect output and has been corrected; atestGroupAsRightOperandtest was added to cover a group used as the right-hand operand.