Fix year_max returning zero results (enforce year window post-merge)#21
Merged
Conversation
Passing a year window to search_literature returned ZERO results: SciLEx expands a [year_min, year_max] window into one query per year (~26y x N APIs), blowing the per-provider timeout budget so every provider returns [] — an in-range request paradoxically yielded nothing. Fix in DomainAwareAggregator.search: fetch on the fast (no-year) provider path and enforce the [year_min, year_max] window post-merge on each paper's `year` via a new `_within_year_bounds` helper (papers with unknown year are kept). Provider-independent and correct, regardless of how each provider mishandles year filters. Adds a unit test asserting in-range + unknown-year papers are kept, post-cutoff ones dropped, and the window is not forwarded to providers. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
fb192b1 to
9ce57c1
Compare
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.
Problem
Calling
search_literature(or any aggregator path) with ayear_min/year_maxwindow returned zero results, while the same query with no year filter returned papers normally.Root cause: SciLEx expands a
[year_min, year_max]window into one query per year (~26 years × N APIs via its query compositor). That fan-out blows the per-provider timeout budget, so_call_providertimes out and returns[]for every provider — an in-range request paradoxically yields nothing.Fix
In
DomainAwareAggregator.search, fetch on the fast no-year provider path and enforce the[year_min, year_max]window post-merge on each paper'syear, via a new_within_year_boundshelper (papers with an unknown year are kept). This is provider-independent and correct regardless of how each provider handles year filters.Test
Adds
test_year_window_enforced_post_merge_not_forwarded: in-range + unknown-year papers are kept, post-cutoff ones dropped, and the window is not forwarded to providers. All 19 aggregator unit tests pass.🤖 Generated with Claude Code