Add support for distance queries on shape queries#53468
Add support for distance queries on shape queries#53468iverase merged 3 commits intoelastic:masterfrom
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.
It seems our circle interface does not really support cartesian circles.
There was a problem hiding this comment.
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.
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.
| } | ||
|
|
||
| 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.
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.