Meaning of tags in Lucene parser exceptions

39 Views Asked by At

I want to display human readable parse errors from Lucene. Hidden in the suppressed exceptions in ElasticsearchException is some genuinely useful information on what caused a parser error. e.g.

"Encountered \"<EOF>\" at line 1, column 32.\nWas expecting one of:\n    <AND> ...\n    <OR> ...\n    <NOT> ...\n    \"+\" ...\n    \"-\" ...\n    <BAREOPER> ...\n    \"(\" ...\n    \")\" ...\n    \"*\" ...\n    \"^\" ...\n    <QUOTED> ...\n    <TERM> ...\n    <FUZZY_SLOP> ...\n    <PREFIXTERM> ...\n    <WILDTERM> ...\n    <REGEXPTERM> ...\n    \"[\" ...\n    \"{\" ...\n    <NUMBER> ...\n    "

The are from QueryParserConstants and for most of them it is obvious what part of the query syntax they they refer to e.g. CARAT => ^ but some are not so obvious:

<BAREOPER>, <PREFIXTERM>, <REGEXPTERM>, <RANGE_GOOP>

In QueryParserConstants, these names are mapped to integer references to regex terms but, despite having examined the Lucene source code, I still cannot figure out what these ones mean.

Does anyone recognise what these refer to or know where in the code I can find the relevant regex terms, so I can work it out from those?

0

There are 0 best solutions below