You are here

public function SearchApiGroupingMultivalueField::postprocessSearchResults in Search API Grouping 7

Fix potentially split id's.

This is necessary since the id is reused to fetch the related entity.

Overrides SearchApiAbstractProcessor::postprocessSearchResults

File

includes/processor_multivalue_field.inc, line 83
Processor for splitting indexing items on behalf of a multivalue field.

Class

SearchApiGroupingMultivalueField
Processor for splitting up items on behalf of a multivalue field.

Code

public function postprocessSearchResults(array &$response, SearchApiQuery $query) {
  if (!empty($response['results'])) {
    foreach ($response['results'] as $id => &$result) {
      if (mb_strstr($id, ':delta') !== FALSE) {
        $result['id'] = preg_replace('/:delta\\d+/', '', $result['id']);
      }
    }
  }
  return;
}