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

LUCENE-9141: Simplify LatLonShapeXQuery API. #1170

Merged
merged 21 commits into from
Jan 30, 2020

Conversation

iverase
Copy link
Contributor

@iverase iverase commented Jan 15, 2020

This PR tries to simplify the LatLonShape query API. The trick for this simplification is to introduce a new interface called LatLonGeometry which is implemented by objects defining queryable geometries, that is Polygon, Line and the newly introduced Point.

The main feature of those geometries is that they can return a Component2D object that can be used for query the index.

# Conflicts:
#	lucene/core/src/java/org/apache/lucene/document/LatLonShapeLineQuery.java
#	lucene/core/src/java/org/apache/lucene/document/LatLonShapePointQuery.java
#	lucene/core/src/java/org/apache/lucene/document/LatLonShapePolygonQuery.java
#	lucene/sandbox/src/java/org/apache/lucene/document/LatLonShapeComponent2DQuery.java
#	lucene/sandbox/src/java/org/apache/lucene/document/LatLonShapePolygonQuery.java
@iverase
Copy link
Contributor Author

iverase commented Jan 20, 2020

Update the PR by making LatLonGeometry an abstract class so the method that return a Component2D can be made protected.

Copy link
Member

@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.

Nice. Love the reduction of the three query classes to the single LatLonShapeQuery. Left one question, otherwise it LGTM


/** create a query to find all indexed geo shapes that intersect a provided geometry collection.
**/
public static Query newGeometryCollectionQuery(String field, QueryRelation queryRelation, LatLonGeometry... latLonGeometries) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: do you think we could just name this newGeometryQuery? This way we just treat geometries and single and/or collections? Feels a little less confusing IMHO.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think it is a better name

@iverase iverase merged commit a948291 into apache:master Jan 30, 2020
asfgit pushed a commit that referenced this pull request Jan 30, 2020
@iverase iverase deleted the simplifyLatLonShapeQuery branch January 30, 2020 07:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants