Looking at the source code, it seeks as if only a limited syntax is
supported for field names (VARIABLE in the code) within Lucene Expressions
that corresponds to a subset of what Java/JavaScript/ECMAScript support
(ID: [_$a-zA-Z] [_$a-zA-Z0-9]*, plus a dotted list of IDs), and certainly
much less than the anything-goes model that Lucene and Solr currently
support. Is this really the case? If so, there should be a clear statement
in the Javadoc concerning this limitation.

The package Javadoc currrently only says "Arbitrary external variables -
see Bindings", but Bindings adds no significant info on the matter or
variable/field-name syntax. Especailly the common case of hyphen in field
names.

See:
http://lucene.apache.org/core/5_5_0/expressions/org/apache/lucene/expressions/js/package-summary.html
https://github.com/apache/lucene-solr/blob/master/lucene/expressions/src/java/org/apache/lucene/expressions/js/Javascript.g4

I didn't see any mechanism for escaping or quoting non-Java field names to
work around this limitation. A simple hack workaround would be to add a
builtin function that takes a field name as a string and then executes the
same code as for a VARIABLE binding.

-- Jack Krupansky

Reply via email to