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

Refactor of GeoShapeQuery #13466

Closed
wants to merge 0 commits into from
Closed

Refactor of GeoShapeQuery #13466

wants to merge 0 commits into from

Conversation

colings86
Copy link
Contributor

Moving the query building functionality from the parser to the builders
new toQuery() method analogous to other recent query refactorings.

Relates to #10217

PR goes against the query-refactoring branch

INTERSECTS("intersects"),
DISJOINT("disjoint"),
WITHIN("within");
INTERSECTS((byte) 0, "intersects"),
Copy link
Contributor

Choose a reason for hiding this comment

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

can we just use the ordinal() for serialization?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, should I add a simple unit test to make sure the order (and ordinals) of these enum values don't change?

@s1monw
Copy link
Contributor

s1monw commented Sep 10, 2015

I did a first round of review... looks awesome already

@colings86
Copy link
Contributor Author

@s1monw I pushed a commit which should address most of your comments and replied to the others

@colings86
Copy link
Contributor Author

@s1monw actually hold off reviewing again for now, looks like there are test failures I need to sort out

@colings86
Copy link
Contributor Author

@s1monw ok good to go now :)

@@ -37,6 +42,37 @@
this.relationName = relationName;
}

@Override
public ShapeRelation readFrom(StreamInput in) throws IOException {
Copy link
Contributor

Choose a reason for hiding this comment

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

this looks awesome!

Copy link
Member

Choose a reason for hiding this comment

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

for my future reference (we had a similar discussion just today on some other PR), why don't we simply rely on the enum ordinal() here like we already do elsewhere?

Copy link
Contributor

Choose a reason for hiding this comment

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

folks are generally concnered that the ordinal might cahnge if you change the order of the enum. I usually write explicit tests for it but with switch / case it's declerative and that should protect from it?

Copy link
Member

Choose a reason for hiding this comment

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

but it feels like we are back with our own ordinal then, more LOC too with two switches compared to the previous Operator impl :) can't we just handle bw comp once we actually change the enum? of course the main issue is remembering about this, and tests are a good way to remember...

Copy link
Contributor

Choose a reason for hiding this comment

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

++ for ordinal and tests then

@colings86
Copy link
Contributor Author

@s1monw @javanna pushed more commits to address your comments including one to serialize ShapeRelation and SpatialStrategy using the ordinal value, with a Unit test class for each

@s1monw
Copy link
Contributor

s1monw commented Sep 11, 2015

LGTM thanks man!

@colings86 colings86 closed this Sep 11, 2015
@colings86 colings86 reopened this Sep 11, 2015
@colings86 colings86 closed this Sep 11, 2015
@colings86 colings86 deleted the refactor/geo-shape-query branch September 11, 2015 08:29
@clintongormley clintongormley added :Search/Search Search-related issues that do not fall into other categories and removed :Query Refactoring labels Feb 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Search/Search Search-related issues that do not fall into other categories
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants