arXiv / arxiv-search

arXiv Search UI & APIs
https://arxiv.github.io/arxiv-search/
MIT License
96 stars 15 forks source link

Malformed queries not registering exceptions in classic API #253

Closed JaimieMurdock closed 5 years ago

JaimieMurdock commented 5 years ago

via @DavidLFielding :

I did notice that the parser seems to concentrate most of its effort on well-formed queries. That is, I did not see a lot of code detecting bad state transitions in the parsing routine. While I did resubmit a few of the bad queries and received the "Cannot parse fragment:" error I decided to toss a few more bad queries at the API. Many of these queries returned search results instead of generating an error. This might be due to my lack of understanding about the search engine and potential query cleanup optimizations.

If the assumption for the classic API interface is that the client is generating well-formed queries (possibly programmatically) then the concern I raise here is not important.

Though the idea that I may submit a poorly-formed query and get results has me wondering about how to interpret the results.

As a few trivial examples I hacked a few of the sample queries above:

http://127.0.0.1:5000/query?search_query=ti:photons+AND+AND+ti:dark

http://127.0.0.1:5000/query?search_query=ti:photons+ANDNOT+AND++OR+ti:dark+ANDNOT

These queries, while similar to some of the 'bad queries' in the tests, unexpectedly return results instead of an error.

JaimieMurdock commented 5 years ago

Closed in 67b754d