-
Notifications
You must be signed in to change notification settings - Fork 25.2k
Remaining queries for long script field #59816
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
Remaining queries for long script field #59816
Conversation
Adds the `terms` and `range` queries for `long` typed `script` fields. It also fixes a bug in a few of `toString` tests for `keyword` typed `script` fields.
Pinging @elastic/es-search (:Search/Search) |
Looks like the test failure on this one is real. I'll have a look. |
I've pushed an update! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
left one comment around the changes to NumberFieldMapper. LGTM otherwise
@@ -906,6 +880,51 @@ public static long objectToLong(Object value, boolean coerce) { | |||
String stringValue = (value instanceof BytesRef) ? ((BytesRef) value).utf8ToString() : value.toString(); | |||
return Numbers.toLong(stringValue, coerce); | |||
} | |||
|
|||
@FunctionalInterface | |||
public interface RangeQueryBuilder { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
functions are cool, but couldn't we have a shared method that does the boiler-plate range conversion, which is called when creating the lucene query?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
potentially, that could even be pushed upstream? I would love to not have changes to this mapper as part of the feature branch, if possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think Elasticsearch is mostly responsible for the Object
to long
stuff. I don't think that is something Lucene wants but I could certainly be wrong.
I would love to not have changes to this mapper as part of the feature branch, if possible.
I could copy and paste the code but I think that'd be dangerous as it'd get out of sync if someone made a chance to the mapper.
functions are cool, but couldn't we have a shared method that does the boiler-plate range conversion, which is called when creating the lucene query?
I think that is what this is. I could probably write it in a way that doesn't use the functional interface if you'd prefer, but it'll be a little more jumbled. It might still be more clear just because we avoid the indirection.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe I was not too careful looking, but it looked like you were calling the function last in the method, which made me think that you could rather have one method to convert the ranges, though what is the return type of that method going to be? Maybe I start to see how a function simplifies it. I don't have a strong opinion. Maybe make it a BiFunction ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've pushed a BiFunction
. Do you think that is better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks @javanna ! |
Adds the
terms
andrange
queries forlong
typedscript
fields.It also fixes a bug in a few of
toString
tests forkeyword
typedscript
fields.Relates to #59332