-
Notifications
You must be signed in to change notification settings - Fork 38
-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clearer exception: "Field \'" + name + "\' cannot be used in an expression: it was not registered with sort=true" #79
Comments
Seems like this is an issue when trying to retrieve multivalued doc values in expressions. Lucene Bindings base class is somewhat limited in that it can return DoubleValuesSource which support only single double values. Code flowThe issue happens when using FunctionScoreQuery, which is creates like We extend Bindings class and override DoubleValuesSource API in lucene seems to support only getting a single double value We can have implementations our own DoubleValuesSource to support custom functions to retrieve specific value from a multivalued field like
Also if the script is just referring to a multiValued field in an Expression we should throw a more comprehend able exception. |
This error in FieldDefBindings:
throw new IllegalArgumentException("Field \'" + name + "\' cannot be used in an expression: it was not registered with sort=true");
is essentially thrown when either the field is not virtual or is a field (including numeric) not having doc values typeDocValuesType.NUMERIC
. So this error can even be thrown if either the field was not numeric, or was numeric but multivalued, or was numeric but doc values were not stored. Addingsort: true
for the fields in such cases will still keep throwing this error. We can probably change this exception to reflect the required condition, i.e. the field type is not virtual or does not have NUMERIC doc values.The text was updated successfully, but these errors were encountered: