

Sales search: Writing a query parser/AST using Pyparsing+Elasticsearch (part 2) - thomas-st
http://blog.close.io/post/49711234004/sales-data-search-writing-a-query-parser-ast-using

======
samps
I've seen many parsers, from ad-hoc regexes to real grammars like this one,
that attempt to process natural, human-readable query strings that resemble
Google searches. (The example at the top of this writeup, `john city:"new
york" last_called < "3 days ago"`, illustrates what I'm talking about.) But
there's no standard definition that I know of that could make all these
slightly-different implementations interoperate.

Does anyone know of any specification of a colon-style query syntax that other
projects could reuse? Even something semi-formal would be better than nothing.

~~~
mhluongo
Google "lucene query syntax"- it's pretty common. In fact, the only reason it
seems they needed pyparsing (from the last article) instead of using Lucene
syntax (which Elasticsearch supports) is to support more field operators like
'>'.

EDIT: If you're a Python guy we've published a library to make generating such
query strings easier - <https://github.com/scholrly/lucene-querybuilder>

