You are here

protected function SearchApiHighlight::flattenKeysArray in Search API 7

Extracts the positive keywords from a keys array.

Parameters

array $keys: A search keys array, as specified by SearchApiQueryInterface::getKeys().

Return value

array An array of all unique positive keywords contained in the keys.

1 call to SearchApiHighlight::flattenKeysArray()
SearchApiHighlight::getKeywords in includes/processor_highlight.inc
Extracts the positive keywords used in a search query.

File

includes/processor_highlight.inc, line 287
Contains the SearchApiHighlight class.

Class

SearchApiHighlight
Processor for highlighting search results.

Code

protected function flattenKeysArray(array $keys) {
  if (!empty($keys['#negation'])) {
    return array();
  }
  $keywords = array();
  foreach ($keys as $i => $key) {
    if (!element_child($i)) {
      continue;
    }
    if (is_array($key)) {
      $keywords += $this
        ->flattenKeysArray($key);
    }
    else {
      $keywords[$key] = trim($key);
    }
  }
  return $keywords;
}