Reputation: 477
I'm using Hibernate Search 5 to implement a full text service implementation with Apache Lucene. I'm able to get the text search working by following the steps in this site.
Now I need to add a geo location(lat/lon) fields in the entity and referring to this documentation, it seems hibernate allows defining one using @Latitude
& @Longitude
annotation.
My requirement is to find all entities that matches a given keyword and falls within bounding geo polygon(given a top left corner point and bottom right corner point of the bounding box).
Referring further in the hibernate documentation, I found support for finding entities within a specific distance(more like a bounding circle) as below
org.apache.lucene.search.Query luceneQuery = builder
.spatial()
.within( radius, Unit.KM )
.ofLatitude( centerLatitude )
.andLongitude( centerLongitude )
.createQuery();
Is there a way to do search by bounding polygon instead of radius ?
As a workaround, I can give a radius large enough to bound my box however i'll end up doing over fetching the data.
Upvotes: 0
Views: 172
Reputation: 9977
There is no support for bounding box queries in Hibernate Search 5.
There is such support in Hibernate Search 6: see this part of the documentation. Hibernate Search 6 is currently in Beta and the API is different from Hibernate Search 5.
Upvotes: 1