You are here

public function SearchApiIndex::postprocessSearchResults in Search API 7

Postprocess search results before display.

If a class is used for both pre- and post-processing a search query, the same object will be used for both calls (so preserving some data or state locally is possible).

Parameters

array $response: An array containing the search results. See SearchApiServiceInterface->search() for the detailed format.

SearchApiQuery $query: The object representing the executed query.

Return value

SearchApiIndex The called object.

File

includes/index_entity.inc, line 725
Contains SearchApiIndex.

Class

SearchApiIndex
Class representing a search index.

Code

public function postprocessSearchResults(array &$response, SearchApiQuery $query) {

  // Postprocessing is done in exactly the opposite direction than preprocessing.
  foreach (array_reverse($this
    ->getProcessors()) as $processor) {
    $processor
      ->postprocessSearchResults($response, $query);
  }
  return $this;
}