Projection nesting: preserving the document structure in projections
As of HSEARCH-3391, given the following document:
... you can retrieve all values of "authors.firstName" in a single list (List<String>, ["Daniel", "Ty"]), and you can retrieve all values of "authors.lastName" in another list (List<String>, ["Abraham", "Frank"]). These projections are effectively flattened, because the "authors" part of the structure is gone.
What you cannot do is retrieve all the pairs firstName/lastName (List<AuthorDto>, [AuthorDto(firstName = "Daniel", lastName = "Abraham"), AuthorDto(firstName = "Ty", lastName = "Frank")]). In order for that to be possible, we would need some way to tell Hibernate Search "these two fields must be grouped together for each author", similarly to the "nested" predicate.
Note that for the Elasticsearch backend we could make this "grouping" work regardless of whether "authors" is nested or flattened, because we have the full JSON. However, that's not the case for the Lucene backend.
Tickets depending on this: