-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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
Deprecate GeoDistance enums and remove geo distance script helpers #19783
Conversation
*/ | ||
@Deprecated |
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.
Why are we deprecating and not removing these? We know they don't work in scripts, so what uses could their be other than in our own code?
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.
None. I'll remove the deprecation.
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.
Forgot to mention the GeoDistance class is coupled with the GeoDistance query parser. That's why I started w/ deprecation. I plan to completely remove the GeoDistance class but would rather do it in a few small PRs than one large one. Any issue keeping it in this one and I'll remove it in the next PR?
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.
Sure, Ok.
I left a couple comments. This is a good start, but I think we should cut it down further to have one way to calculate distance (GeoUtils methods) and leave edge cases (wanting to convert from meters to something else) as an exercise for the user (finding a constant and multiplying). |
Thx for the feedback @rjernst. I went ahead and removed the DistanceUnit argument. I'll tackle the enum removal in the next PR and look at removing the GeoPoint allocations in a follow up PR. |
e67f910
to
cbc233d
Compare
GeoDistance is implemented using a crazy enum that causes issues with the scripting modules. This commit moves all distance calculations to arcDistance and planeDistance static methods in GeoUtils. It also removes unnecessary distance helper methods from ScriptDocValues.GeoPoints.
cbc233d
to
2d590af
Compare
@nknize given that this is a breaking change, please can we have a note in the migration docs? |
Thx @clintongormley! I updated the migration docs to reflect the breaking change to geo scripts. |
GeoDistance is implemented using a crazy enum that causes issues with the scripting modules. This PR moves all distance calculations to
arcDistance
andplaneDistance
static methods inGeoUtils
. It also removes unnecessary distance helper methods fromScriptDocValues.GeoPoints
. Docs and tests are updated to reflect changes.