Skip to content
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

Merged
merged 3 commits into from
Mar 19, 2020

Conversation

iverase
Copy link
Contributor

@iverase iverase commented Mar 12, 2020

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.

@iverase iverase added >feature :Analytics/Geo Indexing, search aggregations of geo points and shapes labels Mar 12, 2020
@iverase iverase requested review from imotov and nknize March 12, 2020 10:40
@elasticmachine
Copy link
Collaborator

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());
Copy link
Contributor Author

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.

Copy link
Contributor

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

Copy link
Contributor

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.

Copy link
Contributor

@nknize nknize left a 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());
Copy link
Contributor

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

@jpountz jpountz mentioned this pull request Mar 17, 2020
22 tasks
@iverase iverase merged commit 112ae9c into elastic:master Mar 19, 2020
iverase added a commit to iverase/elasticsearch that referenced this pull request Mar 19, 2020
With the upgrade to Lucene 8.5, XYShape field has support for distance queries. This change implements this new feature and removes the limitation.
@iverase iverase deleted the shapeCircle branch March 19, 2020 13:35
iverase added a commit that referenced this pull request Mar 19, 2020
With the upgrade to Lucene 8.5, XYShape field has support for distance queries. This change implements this new feature and removes the limitation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Analytics/Geo Indexing, search aggregations of geo points and shapes >feature v7.7.0 v8.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants