Skip to content

Conversation

@nknize
Copy link
Contributor

@nknize nknize commented Dec 6, 2017

#9120 added WKT support for BBOX (...
This PR adds WKT parsing support to GeoBoundingBoxQueryBuilder

closes #27690

@nknize nknize added :Analytics/Geo Indexing, search aggregations of geo points and shapes :Query DSL v6.2.0 v7.0.0 labels Dec 6, 2017
@nknize nknize requested a review from cbuescher December 6, 2017 18:12
@nknize
Copy link
Contributor Author

nknize commented Dec 6, 2017

@cbuescher This is the separate PR we talked about creating for added BBOX support to GeoBoundingBoxQueryBuilder This needs to be done before opening the PR for the new geo_bounding_box field. I incorporated the feedback you gave when I first added it to #27417

@cbuescher cbuescher self-assigned this Dec 6, 2017
Copy link
Member

@cbuescher cbuescher left a comment

Choose a reason for hiding this comment

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

@nknize great, I left a few comments but mostly minor stuff. I'm in favour of the inner "field" parameter, but can you double check that we didn't document it at some point? Maybe we should keep it at least in 6.2 (with deprecation) and remove in 7.0 just to be save, not sure how much this complicates things though.

Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure we need to support WKT in toXContent if only for testing. The idea so far was to have one "cannonical" form the builder represents itself and the information is the same. Just my 2cents here atm.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, that keeps things simple. Then if users really want the original WKT representation they can always add a stored field, multifield, or pull from source.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, however I might be overlooking something but I think that should be enough. We are not talking about documents here now, where the wkt representation should be available from "_source", no? A query builders xContent representation shouldn't normally be something you store, but I might be wrong. But I would revisit this only if the need arises.

Copy link
Member

Choose a reason for hiding this comment

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

Can the delta be lower here? Just wondering if there is a reason for the relatively high error margin, this is only testing parsing, or do we already loose that much precision when storing the coords in the builder?

Copy link
Member

Choose a reason for hiding this comment

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

+1 for dropping this variant in 7.0, but was this already deprecated at some point? I didn't see it being documented anywhere but we might still need to officially deprecate it in 6.x

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 this has been deprecated in 6.x yet. I'll do that when I merge to 6.x in lieu of removal

Copy link
Member

Choose a reason for hiding this comment

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

Can you change to the regular cast operator unless there is a specific reason for the Class.cast here? I think its more obvious whats happening and doesn't hide potential warnings etc... at compile time.

Copy link
Member

Choose a reason for hiding this comment

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

sparse doesn't seem to get used before, why not just create a new point here?

Copy link
Member

Choose a reason for hiding this comment

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

I think it would be good to have a small test for this kind of type check.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍

@nknize nknize force-pushed the feature/GeoBBoxQueryBuilderWKT branch from ccd3017 to 744f593 Compare January 12, 2018 21:33
@nknize
Copy link
Contributor Author

nknize commented Jan 12, 2018

Sorry for the long delay here @cbuescher. Holidays and end of year funzies. I've gone ahead and fixed up the PR per last round of feedback and its ready for another review. I think this should be close.

Copy link
Member

@cbuescher cbuescher left a comment

Choose a reason for hiding this comment

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

@nknize thanks for updating, I left two minor nits but the rest looks good to me, feel free to adress or drop those comments, no need for another review if nothing else changes I think.

Copy link
Member

Choose a reason for hiding this comment

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

nit: maybe use expectThrows() like we do in many other places

Copy link
Member

Choose a reason for hiding this comment

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

nit: maybe you can use GeoShapeType.GEOMETRYCOLLECTION here instead of null and then check for that enum in the method where the exception might be thrown?

@nknize nknize force-pushed the feature/GeoBBoxQueryBuilderWKT branch 2 times, most recently from 1093c51 to 3987f61 Compare January 15, 2018 19:13
Add WKT BBOX parsing support to GeoBoundingBoxQueryBuilder.
@nknize nknize force-pushed the feature/GeoBBoxQueryBuilderWKT branch from 3987f61 to 5ed25f1 Compare January 15, 2018 19:31
@nknize nknize merged commit 5ed25f1 into elastic:master Jan 15, 2018
@clintongormley clintongormley added :Search/Search Search-related issues that do not fall into other categories and removed :Query DSL labels Feb 14, 2018
@jpountz jpountz removed the :Search/Search Search-related issues that do not fall into other categories label Jan 29, 2019
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 >enhancement v6.2.0 v7.0.0-beta1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add WKT support to GeoBoundingBoxQueryBuilder

5 participants