$pattern->
setTokenTerms($matches);
$scoring =
$this->
score($tokens, ArrayNormalizer::
flatten($matches));
// only use the 8 best matches, otherwise the query might explode
$scoring = \
array_slice($scoring, 0, self::RELEVANT_KEYWORD_COUNT, true
);
foreach ($scoring as $keyword =>
$score) { $this->logger->
info('Search match: ' .
$keyword . ' with score ' .
(float) $score);
} foreach ($scoring as $keyword =>
$score) { $pattern->
addTerm(new SearchTerm((string) $keyword,
$score));
} return $pattern;
} /**
* @param list<string> $tokens
*
* @return list<string>
*/
private function permute(array
$tokens): array
{