Skip to main content

zero_result_hint

Function zero_result_hint 

Source
pub fn zero_result_hint(query: &str) -> Option<String>
Expand description

Advice to attach to a paper search that matched nothing (#534).

OpenAlex free-text matching degrades sharply as a query lengthens: past roughly eight terms it returns nothing at all rather than a partial match. A human reading 0 results shortens the query and tries again. An agent reading ok: true with an empty array reads it as a fact about the world and stops – in the session that produced #534, eleven consecutive searches returned zero for papers a three-to-five term query then found immediately, and a known study was written off as unavailable.

Returns None for short queries: a zero-result two-term search really may mean the work is not indexed, and a hint on every empty result would train readers to skip it.

Lives here rather than on either front end because both surfaces call paper_search and both can return the empty envelope. The first fix landed only on the MCP tool, so doiget search --mode json went on emitting the exact envelope #534 was filed about.