-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
Add support for distance queries on shape queries #53468
Conversation
Pinging @elastic/es-analytics-geo (:Analytics/Geo) |
} | ||
|
||
public static org.apache.lucene.geo.XYCircle toLuceneXYCircle(Circle circle) { | ||
return new org.apache.lucene.geo.XYCircle((float) circle.getX(), (float) circle.getY(), (float) circle.getRadiusMeters()); |
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.
It seems our circle interface does not really support cartesian circles.
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.
Yeah, it is a bit misleading to have the Geometry API specify the circle radius as getRadiusMeters
. Probably worth a clean up in another PR. /cc @imotov
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.
Yeah, I am not particularly happy with my decision to go with meters here. I think it was a mistake. I agree we need to clean this up, but it probably deserves some brainstorming and definitely a separate PR since it affects SQL as well.
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.
This LGTM. I wouldn't mind @imotov thoughts on the Circle interface. Probably can be handled in a separate PR.
} | ||
|
||
public static org.apache.lucene.geo.XYCircle toLuceneXYCircle(Circle circle) { | ||
return new org.apache.lucene.geo.XYCircle((float) circle.getX(), (float) circle.getY(), (float) circle.getRadiusMeters()); |
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.
Yeah, it is a bit misleading to have the Geometry API specify the circle radius as getRadiusMeters
. Probably worth a clean up in another PR. /cc @imotov
With the upgrade to Lucene 8.5, XYShape field has support for distance queries. This change implements this new feature and removes the limitation.
With the upgrade to Lucene 8.5, XYShape field has support for distance queries. This change implements this new feature and removes the limitation.
In addition the strategy for building queries is changed as Lucene adds a new interface method called XYShape.newGeometryQuery that takes an array of Lucene geometries. This allows the query engine to build the most efficient query for the given parameters. For example an intersect query with a geometry collection currently creates one query per geometry. With this change, the engine can build just one query with all geometries.