Hibernate Search already supports spatial search whereby:
- Documents are assigned coordinates (latitude, longitude)
- A query specifies a range by means of coordinates and a radius
- Documents whose coordinates are within the query range are found
The goal would be to expand spatial search to support the following:
- Documents are assigned a range by means of coordinates and a radius
- A query specifies a range by means of coordinates and a radius
- Documents whose ranges intersect the query range are found
Elasticsearch provides GeoShape queries allowing documents with locations defined by means of shapes to be matched by similarly defined queries. Different shapes (e.g. polygon, circle) and spatial relation operators (e.g. intersection, disjunction) are supported. Apparently, there's even support for multiple locations per document. The first version of this new Hibernate Search functionality could support a subset of what's provided by Elasticsearch, namely the possibility to search for documents associated with a single shape circle defined location using a query specifying a single shape circle defined location and the spatial relation operator intersection, fulfilling the following use case: Users find each other when their ranges, defined by tuples (latitude, longitude, radius), intersect. 2 users, located at 2 different coordinates, are 10 km apart. Assuming they define the same radius, they will find each other when the radii is set to at least 5 km. Initial discussion: https://discourse.hibernate.org/t/spatial-range-search/950 |