The ConnectedMultiFieldsRangeQueryBuilder component of the Query DSL is responsible for factoring TermRange or NumericRange queries.
It currently picks the appropriate strategy by evaluating the mapping metadata of the targeted field, but when the target field is not known, it fallbacks to a TermRange query.
The Hibernate HQL query component which renders Lucene based queries by using the Query DSL however might have a better guess as it can work with an injected properties resolver to work with dynamic entity types, and will parse string tokens into their correct data types passing them to ConnectedMultiFieldsRangeQueryBuilder for example as a Long. So the better fallback strategy for the DSL is to guess the appropriate type of range query from the arguments type (the upper/lower bounds).
|