You are here

public function FuzzysearchExcerpt::postprocessSearchResults in Fuzzy Search 7

Does nothing.

Overrides SearchApiAbstractProcessor::postprocessSearchResults

File

includes/processor_excerpt.inc, line 68
File for processor excerpt.

Class

FuzzysearchExcerpt
Processor to set the index and search settings. Requires FuzzySearchService.

Code

public function postprocessSearchResults(array &$response, SearchApiQuery $query) {
  $keys = $query
    ->getKeys();
  if (is_array($keys)) {
    foreach ($keys as $key => &$v) {
      if (!element_child($key)) {
        unset($keys[$key]);
      }
    }
  }
  if (!empty($response['results'])) {
    $entity_info = entity_get_info($this->index->item_type);

    // Better way to check if we have text?
    if (isset($entity_info['view modes']['full'])) {
      $entities = entity_load($this->index->item_type, array_keys($response['results']));
      foreach ($entities as $key => $entity) {
        $response['results'][$key]['excerpt'] = fuzzysearch_build_excerpt($entity, $this->index, (array) $keys);
      }
    }
  }
}