fix: normalize ISO date equality filters#11963
Open
Aarkin7 wants to merge 4 commits into
Open
Conversation
|
@Aarkin7 is attempting to deploy a commit to the deepset Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
Author
|
The remaining CI failures appear unrelated to this PR. They’re in test/components/generators/chat/test_openai_responses*.py with InputTokensDetails.cache_write_tokens validation errors. This PR only touches filter logic/tests and a release note. |
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.
Related Issues
Proposed Changes:
This fixes a gap in metadata filtering where
==,!=,in, andnot inwere still comparing ISO timestamps as raw strings. That meant equivalent values like2025-02-03T12:45:46Zand2025-02-03T12:45:46+00:00could silently miss matching documents.The fix normalizes date-like values for equality-style filters so they behave consistently with the ordering operators. I also added regression tests for both the filter helper and the
InMemoryDocumentStorepath, plus a release note.How did you test it?
hatch run fmton the touched fileshatch run test:unit test/utils/test_filters.pyInMemoryDocumentStorefilter tests==andinnow return matches for equivalent ISO timestampsNotes for the reviewer
The main logic change is in
haystack/utils/filters.py.The most useful review points are:
filters.pytest/utils/test_filters.pytest/document_stores/test_in_memory.pyChecklist
fix:,feat:,build:,chore:,ci:,docs:,style:,refactor:,perf:,test:and added!in case the PR includes breaking changes.