I'm currently working on a new module (Search API Grouping) that allows you to split indexing item on behalf of a multivalue field. At the same time the module provides result grouping based on this:
This featureset becomes handy if you've to do some complex searches which fail using a multivalue field (e.g. Date-Repeats).
The problem is, that I've to provide unique ids for the items to index. Thus I add the delta of the multivalue field to the original id in preprocessIndexItems().
In postprocessSearchResults() I restore the original id of the results.
SearchApiViewsQuery::addResults() the array key (which I can't change) is used instead the id value of the result item to fetch the related entities.
Change the code to deal with the id value of the result items instead the array key - which is more like a search index id than result id. The attached exactly does this.
If there's a smarter way to provide this feature e.g. having control over the created search index id without affecting the result id I'll happily change the approach - currently a lot of pre/post processing is necessary...
- Clarify if other locations need to be adjusted to handle this use case (Search Pages?)
- Reviews needed
User interface changes