E.g. something like this:
List<MyProjection> searchSession.search(MyEntity.class)
.select(f -> f.distance("location").fromParam("center"))
.where(f -> f.matchAll())
.param("center", someValue) .fetchHits(20);
Or, more interestingly:
List<MyProjection> searchSession.search(MyEntity.class)
.select(MyProjection.class) .where(f -> f.matchAll())
.param("center", someValue) .fetchHits(20);
This is necessary in order to support things like @DistanceProjection (see https://hibernate.atlassian.net/browse/HSEARCH-4574 ), where the projection itself is defined at compile time, but obviously the location the distance is computed from is defined at runtime (most likely from user input). Let’s start with allowing to:
- define parameters when building a query
- use parameters in the distance projection f.distance("location").fromParam("center")
- use parameters as the value to match in predicates: f -> f.match().field("foo").matchingParam("foo"), f -> f.terms().field("foo").matchingParamAny("foo"), etc.
|