Repository navigation
fix: qdrant - match numeric filter values with a closed range - #4161
Conversation
|
Hi @inamdarmihir, thanks for your interest in contributing to Haystack! 🙏 This is an automated message to help us keep the review queue healthy. |
MatchValue rejects floats and does not match float payloads for int values. Build a closed Range(gte=v, lte=v) for numeric non-bool values in ==, !=, in and not in. Strings, bools and ints beyond 2**53 (not exactly representable as float64 on the server) keep MatchValue. Fixes deepset-ai#4096
c4c07c6 to
c790089
Compare
Coverage report (qdrant)Click to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||
|
Hi @inamdarmihir, thanks a lot for your contribution! 🙏 We noticed that the Contributor License Agreement (CLA) check ( To get your PR reviewed, please sign the CLA via the link in the |
|
Hi @inamdarmihir, just a friendly reminder: this PR is still in draft because the Contributor License Agreement (CLA) hasn't been signed yet. We'd love to review your contribution! Please sign the CLA via the link in the |
|
Hi @inamdarmihir, this PR is still waiting for the Contributor License Agreement (CLA) to be signed. Please note that if the CLA isn't signed within the next 4 days, this PR will be automatically closed as stale. Signing only takes a minute via the link in the |
|
Thanks for signing the CLA, @inamdarmihir! 🎉 This PR is now ready for review again and the reviewer has been re-assigned. |
…lter-match # Conflicts: # integrations/qdrant/tests/test_filters.py
Related Issues
Proposed Changes:
QdrantDocumentStorebuilt aMatchValuefor every==,!=,inandnot invalue.MatchValueonly acceptsstr,intandbool, which caused two problems:ValidationError.== 4skipped a document stored with4.0._build_eq_conditionnow matches numeric non-bool values with a closed range,Range(gte=value, lte=value). Qdrant compares ranges numerically against int and float payloads, and for array payloads it matches any element, asMatchValuedoes.!=,inandnot ingo through_build_eq_condition, so they get the same behaviour without further changes.Strings and bools keep
MatchValue. Ints withabs(value) > 2**53also keepMatchValue, because the server compares ranges as float64 and a range on2**60would also match2**60 + 1.How did you test it?
integrations/qdrant/tests/test_filters.pyfor the generated conditions: numeric==uses a range; bools, strings and ints above2**53keepMatchValue;in,not inand!=with mixed numerics.:memory:tests against payloads[3, 4, 4.0, 4.5]:== 4returns[4, 4.0],== 4.5returns[4.5], and!=,inandnot inbehave consistently.== Truedoes not match a payload of1.tests/test_filters.pygave 15 failed and 73 passed, all from pydanticValidationErroron float values. After the fix it gives 88 passed and 1 skipped, andpytest tests -m "not integration"gives 156 passed.ruff checkandruff format --checkpass on the touched files.:memory:mode, not a Qdrant server.Notes for the reviewer
The new
:memory:tests live inTestQdrantFilters, which is markedintegrationbut runs in:memory:mode.Authored by Mihir Inamdar.
Checklist
fix:,feat:,build:,chore:,ci:,docs:,style:,refactor:,perf:,test:.