protected function FuzzySearchService::eliminateDuplicates in Fuzzy Search 7
Helper method for eliminating duplicates from the search keys.
1 call to FuzzySearchService::eliminateDuplicates()
- FuzzySearchService::prepareKeys in includes/
service.inc - Helper method for removing unnecessary nested expressions from keys.
File
- includes/
service.inc, line 921
Class
- FuzzySearchService
- Search service class using the database for storing index information.
Code
protected function eliminateDuplicates($keys, &$words = array()) {
foreach ($keys as $i => $word) {
if (!element_child($i)) {
continue;
}
if (is_scalar($word)) {
if (isset($words[$word])) {
unset($keys[$i]);
}
else {
$words[$word] = TRUE;
}
}
else {
$keys[$i] = $this
->eliminateDuplicates($word, $words);
}
}
return $keys;
}