protected function Highlight::flattenKeysArray in Search API 8
Extracts the positive keywords from a keys array.
Parameters
array $keys: A search keys array, as specified by \Drupal\search_api\ParseMode\ParseModeInterface::parseInput().
Return value
string[] An array of all unique positive keywords contained in the keys array.
1 call to Highlight::flattenKeysArray()
- Highlight::getKeywords in src/
Plugin/ search_api/ processor/ Highlight.php - Extracts the positive keywords used in a search query.
File
- src/
Plugin/ search_api/ processor/ Highlight.php, line 421
Class
- Highlight
- Adds a highlighted excerpt to results and highlights returned fields.
Namespace
Drupal\search_api\Plugin\search_api\processorCode
protected function flattenKeysArray(array $keys) {
if (!empty($keys['#negation'])) {
return [];
}
$keywords = [];
foreach ($keys as $i => $key) {
if (!Element::child($i)) {
continue;
}
if (is_array($key)) {
$keywords += $this
->flattenKeysArray($key);
}
else {
$keywords[$key] = $key;
}
}
return $keywords;
}