omi icon indicating copy to clipboard operation
omi copied to clipboard

arXiv search pre-encodes search_query, so multi-word and AND queries return empty feeds

Open Da7em-T opened this issue 2 months ago • 0 comments

plugins/omi-arxiv-app/main.py builds search_query with urllib.parse.quote_plus and joins fields with +AND+, then passes that string through httpx.AsyncClient.get(..., params=...).

httpx form-encodes the params a second time. Spaces that were already turned into + become %2B. arXiv treats %2B as a literal plus, not as AND/space, and returns an Atom feed with no entry elements.

I reproduced this against the current production helpers, without live arXiv:

  1. _build_search_query({"query": "machine learning"}) returns all:machine+learning.
  2. urllib.parse.urlencode({"search_query": that}) yields search_query=all%3Amachine%2Blearning.
  3. The same helper for query+title becomes all:transformer+AND+ti:attention, which urlencode turns into %2BAND%2B.
  4. The documented encoding for a space/AND is + (all%3Amachine+learning / ...+AND+ti%3A...). %2B is the wrong character.

Single-token queries such as transformer do not insert a +, so they still work. Multi-word queries, author names with spaces, and combined field filters do not.

The public arXiv API manual and the arxiv.py wrapper both require leaving search_query unencoded and letting the HTTP client apply form encoding once.

This is a synthetic contract reproduction of the production query builder. It is not a live arXiv outage report.

Da7em-T avatar Sep 12 '26 10:09 Da7em-T