The idea would be to allow to create {{SearchProjection<T>}} objects from a {{SearchTarget}}, and use these objects when creating a query: {{.asProjections( projectionObject1, projectionObject2, ...)}}.
This would allow three things:
* Implementation of parameterized projections, where naming the projection is not enough, and we need to pass parameters to it. See for example the spatial distance projections, where we need to pass a latitude and longitude: HSEARCH-3190 * Enabling of and disabling bridges in projections; see HSEARCH- 3223 3257 * Type-safe projections, i.e. passing typed references to the {{asProjections()}} methods, and get a {{SearchQuery<Pair<T, U>>}}, or {{SearchQuery<Triplet<T, U, V>>}}, and so on depending on the number of parameters. This would obviously only be possible for a small number of parameters (say, up to 5), because we would have to declare and implement one {{asProjections()}} method for each possible number of parameters. Note that, in order to allow that, we should at the very least make {{asProjections}} set the query type to {{SearchQuery<? extends List<?>>}} instead of the current {{SearchQuery<List<?>>}}.
See also HSEARCH-2265 |
|