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 GeoPolygonQuery #13426

Merged
merged 1 commit into from
Sep 11, 2015
Merged

Refactor of GeoPolygonQuery #13426

merged 1 commit into from
Sep 11, 2015

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

@Override
protected Query doToQuery(QueryShardContext context) throws IOException {

if (!shell.get(shell.size() - 1).equals(shell.get(0))) {
Copy link
Member

Choose a reason for hiding this comment

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

I'd slightly prefer to do this before or into a copy of the shape? I think only the latter is possible though, not sure. Also, maybe it is not a big deal to auto close and change the original shape...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think it's going to be possible to do this before the toQuery method. I can copy the shape but these shapes can be big and complex so I'd only want to do that if we need to. I guess one side effect of doing this here is that two QueryBuilders which are identical before the toQuery method is called (pass hashCode and Equals checks) would then not be equal after calling toQuery on only one of them. So actually maybe we should make a copy here? I'm torn

Copy link
Member

Choose a reason for hiding this comment

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

I am thinking it is not worth it. Hopefully it won't cause problems to our test infra as we don't check the object after calling toQuery...... should we have done it in the first place? :)

@javanna
Copy link
Member

javanna commented Sep 10, 2015

left a few minor comments, looks good already though

@colings86
Copy link
Contributor Author

@javanna I pushed a commit to address your comments


private Boolean ignoreMalformed;
public GeoPolygonQueryBuilder(String fieldName) {
this.fieldName = fieldName;
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 call this(fieldName, new ArrayList()); instead?

@s1monw
Copy link
Contributor

s1monw commented Sep 10, 2015

left some minors - looks great

@colings86
Copy link
Contributor Author

@s1monw thanks for the review. I've push a new commit that should address all your comments

@colings86 colings86 changed the title Query Refactoring: Refactor of GeoPolygonQuery Refactor of GeoPolygonQuery Sep 10, 2015
@s1monw
Copy link
Contributor

s1monw commented Sep 10, 2015

LGTM

// percolation queries we only ignore_malformed on 2.x created indexes
if (!indexCreatedBeforeV2_0 && !ignoreMalformed) {
for (GeoPoint point : shell) {
if (point.lat() > 90.0 || point.lat() < -90.0) {
Copy link

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll make a new change to use this once that PR has been pushed

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
@colings86 colings86 merged commit cac72c9 into elastic:feature/query-refactoring Sep 11, 2015
@colings86 colings86 deleted the refactor/geo-polygon-query branch September 11, 2015 06:54
@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