return $config;
} } throw ElasticsearchProductException::
configNotFound();
} private function buildTokenQuery(BoolQuery
$tokenBool, string
$token, SearchFieldConfig
$config, ?string
$root = null
): void
{ $queries =
[];
$searchField =
$config->
isCustomField() ?
$config->
getField() :
$config->
getField() . '.search';
$queries[] =
new MatchQuery($searchField,
$token,
['boost' => 5 *
$config->
getRanking()]);
$queries[] =
new MatchPhrasePrefixQuery($searchField,
$token,
['boost' =>
$config->
getRanking(), 'slop' => 5
]);
$queries[] =
new WildcardQuery($searchField, '*' .
$token . '*'
);
if ($config->
tokenize()) { $ngramField =
$config->
isCustomField() ?
$config->
getField() :
$config->
getField() . '.ngram';
$queries[] =
new MatchQuery($searchField,
$token,
['fuzziness' => 'auto', 'boost' => 3 *
$config->
getRanking()]);
$queries[] =
new MatchQuery($ngramField,
$token);
}