Repository navigation
Conversation
`QdrantFilterExpressionConverter` only handled a `Group` directly under
NOT. Anywhere else, as in `a && (b || c)`, the group fell through to an
empty Qdrant filter, which matches every point. Searches returned
documents the filter excludes, and `delete("(a && b) || c")` deleted
the whole collection. `NOT` of a plain comparison threw instead of
being converted.
Convert a group as its content wherever it appears, negate any NOT
operand, and reject an operand the converter does not know instead of
matching everything.
Signed-off-by: Rohit Behera <[email protected]>
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.
QdrantFilterExpressionConverteronly handles aGroupdirectly underNOT.Anywhere else the group falls through to an empty Qdrant
Filter, and Qdrant treats an empty filter as "match everything".The text parser and
FilterExpressionBuilder.group(...)both produce aGroupfor every parenthesized part, so any filter that mixes&&and||with parentheses is affected.On a real Qdrant, with six documents:
country == 'BG' && (year >= 2020 || genre == 'drama')BGdocument(country == 'BG' && year >= 2020) || genre == 'drama'NOT country == 'BG'RuntimeException: Non AND/OR/NOT expression must have Value right argument!delete("(country == 'BG' && year >= 2020) || genre == 'drama'")doDeleteuses the same converter, which is why the last row deletes everything.The fix converts a group as its content wherever it appears, negates any
NOToperand rather than only a group, and throws for an operand the converter does not know instead of silently matching everything.Tests:
QdrantFilterExpressionConverterTests: groups on either side ofAND/OR, nested groups, a buildergroup(...),NOTwith and without parentheses. 4 fail and 1 errors without the fix.QdrantVectorStoreFilterIT(new, Testcontainers only, noOPENAI_API_KEYneeded): the search cases above plus the delete. 5 fail and 1 errors without the fix, including the emptied collection.QdrantVectorStoreFilterIT7/7,QdrantVectorStoreUpsertIT18/18 pass. Checkstyle and spring-javaformat validate are clean.