I want to add some criteria to hibernate search spatial query. I have a class Store
which has latitude and longitude. Also it has a price attribute. I want to find all the stores around a particular location with price point less than given input. This is how my current code looks:
Session session = getSession(); //getting org.hibernate.Session
FullTextSession fullTextSession = Search.getFullTextSession(session);
QueryBuilder builder = fullTextSession.getSearchFactory().buildQueryBuilder().forEntity(Store.class).get();
org.apache.lucene.search.Query luceneQuery = builder.spatial().onDefaultCoordinates().within(radius.doubleValue(), Unit.KM).ofLatitude(lat.doubleValue())
.andLongitude(lon.doubleValue()).createQuery();
Query hibQuery = fullTextSession.createFullTextQuery(luceneQuery, Store.class);
@SuppressWarnings("unchecked")
List<Menu> menus = (List<Menu>) hibQuery.list();
I want to add a criteria to this with less than condition. I can add hibQuery.setParameter("property", "value");
to it. But I am not able to add a criteria like less than. Any pointers on how I can do that?