From the original ticket (https://hibernate.atlassian.net/browse/HSEARCH-4827): If we feel that it’s useful to allow it, but only when the user is explicitly requesting it, we can expose something like the (currently SPI) rootContext method: org.hibernate.search.engine.search.projection.spi.SearchProjectionBuilderFactory#rootContext. We’d end up with something like this:
Note there’s a similarity between this fromRoot projection and Elasticsearch's concept of reverse_nested aggregations: https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-reverse-nested-aggregation.html . Maybe we could introduce that kind of things later, but that’s definitely beyond the scope of this issue. |