Was looking for something exactly like this, and came across a few others:
https://github.com/nepsilon/search-query-parser
Both look equally good at first glance, which makes it difficult to choose... it'd be awesome if there were some comparison between features/goals