Skip to content

fix: complete partial dates to start of period in range filters - #13342

Merged
sjrl merged 5 commits into
deepset-ai:mainfrom
zhgao:fix/issue-13338
Nov 16, 2026
Merged

sjrl merged 5 commits into
deepset-ai:mainfrom
zhgao:fix/issue-13338

Conversation

@zhgao

@zhgao zhgao commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

Fixes #13338.

When range operators (>, >=, <, <=) receive partial dates like "2024" or "2024-06", the missing month/day were filled from today's date, so >= "2024" silently dropped ~9.5 months of data — and results changed day to day. This PR passes default=datetime(1, 1, 1) to the dateutil fallback so partial dates complete to the start of the period ("2024" → 2024-01-01). The ==/!= paths are unaffected.

Tests: 7 new regression tests (3 fail on the unfixed code, proving the bug); test/utils/test_filters.py — 165 passed. The bug was reproduced locally before fixing.

Note: this fix was developed with AI assistance; the bug was reproduced locally and the patch is covered by regression tests.

zhgao added 3 commits October 20, 2026 04:23
Updated date parsing to handle partial dates consistently.
Added regression test to ensure partial dates resolve to the start of the period instead of the current date.
Fixes the behavior of filter range operators for partial dates to complete them to the start of the period, preventing silent drops of matching documents.
@zhgao
zhgao requested a review from a team as a code owner October 19, 2026 20:29
@zhgao
zhgao requested review from julian-risch and removed request for a team October 19, 2026 20:29
@vercel

vercel Bot commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

@zhgao is attempting to deploy a commit to the deepset Team on Vercel.

A member of the Team first needs to authorize it.

@CLAassistant

CLAassistant commented Oct 19, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@HaystackBot

Copy link
Copy Markdown
Contributor

Hi @zhgao, thanks a lot for your contribution! 🙏

We noticed that the Contributor License Agreement (CLA) check (license/cla) hasn't passed yet, so we've temporarily moved this PR to draft and paused the review assignment.

To get your PR reviewed, please sign the CLA via the link in the license/cla check below (or in the CLA bot comment). As soon as the check turns green, this PR will automatically be marked ready for review again and a reviewer will be re-assigned.

@HaystackBot
HaystackBot removed the request for review from julian-risch October 19, 2026 21:51
@HaystackBot HaystackBot added the cla-pending PR is in draft until the contributor signs the CLA label Oct 19, 2026
@HaystackBot
HaystackBot marked this pull request as draft October 19, 2026 21:51
@HaystackBot
HaystackBot marked this pull request as ready for review October 22, 2026 05:53
@HaystackBot HaystackBot removed the cla-pending PR is in draft until the contributor signs the CLA label Oct 22, 2026
@HaystackBot

Copy link
Copy Markdown
Contributor

Thanks for signing the CLA, @zhgao! 🎉 This PR is now ready for review again and the reviewer has been re-assigned.

Comment thread haystack/utils/filters.py Resolved
@julian-risch
julian-risch requested review from sjrl and removed request for julian-risch November 4, 2026 12:28
@github-actions github-actions Bot added the type:documentation Improvements on the docs label Nov 6, 2026
Comment thread test/utils/test_filters.py Resolved
Comment thread test/utils/test_filters.py Resolved
Comment thread test/utils/test_filters.py Resolved
Comment thread haystack/utils/filters.py Resolved
@github-actions

github-actions Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  haystack/core/pipeline
  pipeline.py
  haystack/utils
  filters.py
Project Total  

This report was generated by python-coverage-comment-action

@sjrl

sjrl commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

hey @zhgao pinging to ask if you have time to work on this

@sjrl sjrl left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@sjrl
sjrl enabled auto-merge (squash) November 16, 2026 07:14
@sjrl
sjrl merged commit 9a3b69c into deepset-ai:main Nov 16, 2026
25 of 26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

topic:tests type:documentation Improvements on the docs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Range filters fill missing parts of partial dates with the current date

5 participants