public function globalCriteria(string
$term, Search
$criteria): Search
{ $splitTerms =
explode(' ',
$term);
$lastPart =
end($splitTerms);
// If the end of the search term is not a symbol, apply the prefix search query
if (preg_match('/^[a-zA-Z0-9]+$/',
$lastPart)) { $term =
$term . '*';
} $query =
new SimpleQueryStringQuery($term,
[ 'fields' =>
['textBoosted'
],
'boost' => 10,
]);
$criteria->
addQuery($query, BoolQuery::SHOULD
);
return $criteria;
} /**
* @param array<string>|array<int, array<string>> $ids
*
* @throws Exception
*
* @return array<int|string, array<string, mixed>>
*/