On the train this past weekend i started trying to tackle the issue of making support for field based queries (ie: "fieldA:valueB") configurable so that it could be turned on/off for certain fields (or left off completely for back-compat with dismax)
Based on yonik's description of edismax, and my initial reading of the code (particularly the use of clause.field and getFieldName in ExtendedDismaxQParser) i was under the impression that if a "clause" consisting of FOO:BAR was encountered, and FOO was not a known field, that the clause would be treated as a literal, and the colon would be escaped before passing it on to ExtendedSolrQueryParser ... essentially that FOO:BAR and FOO\:BAR would be equivalent if FOO is not the name of a real field according to the IndexSchema.
For reasons I don't fully understand yet, this isn't the case – as the attached test shows, the queries are parsed differently, and (evidently) FOO:BAR is parsed as an empty query if FOO is not a real field.
Before I try digging into this too much, I wanted to sanity check:
- is this expected? ... was this done intentionally?
- is this desired? ... is this logical default behavior to have if the field isn't defined? should we have tests to assert this before i start adding more config options to change the behavior?