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 geo polygon query type #613

Merged
merged 2 commits into from
Jan 2, 2024
Merged

Conversation

aprudhomme
Copy link
Contributor

Add support for geo polygon query.

This query applies to the LAT_LON field type with property search: true. The query searches for documents with points contained within a specified set of polygons. Polygons may optionally specify holes to exclude areas.

Polygons are specified in clockwise order, except for holes which are counter clockwise. They must not cross themselves. They must not cross the 180th meridian. See https://lucene.apache.org/core/8_4_0/core/org/apache/lucene/geo/Polygon.html

Polygons must be closed shapes. The first point is automatically duplicated as the last point to accomplish this.

@aprudhomme aprudhomme requested a review from sarthakn7 December 20, 2023 20:12
Geo-Polygon Query
==========================

A query that matches documents with geo point within a defined set of polygons.
Copy link
Contributor

Choose a reason for hiding this comment

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

@aprudhomme should we add the restrictions mentioned in the notes in https://lucene.apache.org/core/8_4_0/core/org/apache/lucene/geo/Polygon.html ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The important ones are in the Polygon comments, but I can add them here too.

I tried to do some digging, and it looks like some of the requirements have to do with conforming to the GeoJson spec. https://datatracker.ietf.org/doc/html/rfc7946#section-3.1.6 Oddly, the winding order in the spec looks like the opposite of the class notes. The spec also says it is ok to ignore the wrong winding order.

I also see that the lucene class detects the winding order in the constructor, so it really might not be vital to functionality. I think I will try writing some tests that use the opposite order, and relax the requirements if they work.

@aprudhomme
Copy link
Contributor Author

I added a reference to the GeoJson standard. Winding order does not seem to matter, so I removed the explicit references from the documentation.

I also added detection for open vs closed polygons, instead of assuming they are all open.

@aprudhomme aprudhomme requested a review from sarthakn7 December 21, 2023 19:55
@aprudhomme aprudhomme merged commit 3fdcfbf into Yelp:master Jan 2, 2024
1 check passed
sarthakn7 added a commit that referenced this pull request Mar 1, 2024
* Fix node resolver for empty/missing files (#587)

* Autogenerated JaCoCo coverage badge

* Bump to v0.26.1 (#588)

* Autogenerated JaCoCo coverage badge

* parallel explain for nrtsearch (#589)

* parallel explain for nrtsearch

* fix nit

* add explain for multi segment parallel

* refactor isExplain in different contexts

* make NRTSearch empty boolean query result constant score 1 (#592)

* make NRTSearch empty boolean query result constant score 1

* fix tests

* soft exception for fvh failures (#593)

* Support unit in SortType (#590)

create sort context and support unit in lat_lon distance sort

* Autogenerated JaCoCo coverage badge

* Upgrade dependencies for snyk check (#596)

* Fix example-plugin test (#598)

* Add page fault metrics (#599)

* Add additional merge metrics (#607)

* Add live setting for verbose index metrics (#608)

* Add live setting for verbose index metrics

* Address review comment

* Autogenerated JaCoCo coverage badge

* Bump to v0.29.0 (#609)

* Add live index settings override from config file (#610)

* Autogenerated JaCoCo coverage badge

* Add ability to update local index live settings (#611)

* Add deadline cancellation for indexing (#612)

* Add geo polygon query type (#613)

* Add geo polygon query type

* Detect closed polygons, update docs

* Autogenerated JaCoCo coverage badge

* Bump to v0.30.0 (#615)

* Testing readthedocs web hooks (#616)

* Add a bare minimum readthedocs config file (#617)

* log more info when fvh failed (#618)

 log more info when fvh failed

* Avoid calling query.toString() (#619)

* add sts for web identity auth (#620)

add sts for web identity auth

* Add search diagnostics to deadline exceeded exceptions (#621)

* Add search diagnostics to deadline exceeded exceptions
---------

Co-authored-by: swekannan <shwethu.kannan93@gmail.com>

* Fixes and spotless apply

* Updated grpc-gateway

---------

Co-authored-by: Andrew Prudhomme <asp@yelp.com>
Co-authored-by: github_actions <runner@fv-az248-700.3twvhzoricxu3figbgb44chhog.cx.internal.cloudapp.net>
Co-authored-by: github_actions <runner@fv-az887-622.kyhrjabtieueri5x0cgfkhfc1a.bx.internal.cloudapp.net>
Co-authored-by: Tao Yu <taoyu@yelp.com>
Co-authored-by: waziqi89 <89210409+waziqi89@users.noreply.github.com>
Co-authored-by: github_actions <runner@fv-az248-372.3twvhzoricxu3figbgb44chhog.cx.internal.cloudapp.net>
Co-authored-by: github_actions <runner@fv-az574-753.esnmgxn14wlejbqjnvhsbsbtxa.dx.internal.cloudapp.net>
Co-authored-by: github_actions <runner@fv-az1272-720.grsihaubamwerhiryzjrxtypna.phxx.internal.cloudapp.net>
Co-authored-by: github_actions <runner@fv-az736-601.alpbqrzxv30uzkvtn2qktnuusd.cx.internal.cloudapp.net>
Co-authored-by: Mohammad Mohtasham <mohm@yelp.com>
Co-authored-by: swekannan <62616258+swekannan@users.noreply.github.com>
Co-authored-by: swekannan <shwethu.kannan93@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants