Skip to content

Fix year_max returning zero results (enforce year window post-merge)#21

Merged
lfnothias merged 1 commit into
mainfrom
fix/aggregator-year-max
Jun 19, 2026
Merged

Fix year_max returning zero results (enforce year window post-merge)#21
lfnothias merged 1 commit into
mainfrom
fix/aggregator-year-max

Conversation

@lfnothias

Copy link
Copy Markdown
Collaborator

Problem

Calling search_literature (or any aggregator path) with a year_min/year_max window 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_provider times 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's year, via a new _within_year_bounds helper (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.

Found while building the Consilium rediscovery benchmark, which needs prior-literature-only retrieval (contamination control). Note: live re-validation is currently confounded by external API rate limits (PubMed quota exhausted, Semantic Scholar 429) — the fix is covered by the unit test.

🤖 Generated with Claude Code

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>
@lfnothias lfnothias force-pushed the fix/aggregator-year-max branch from fb192b1 to 9ce57c1 Compare June 16, 2026 09:49
@lfnothias lfnothias merged commit 8638c1c into main Jun 19, 2026
1 of 2 checks passed
@lfnothias lfnothias mentioned this pull request Jun 19, 2026
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant