fix usage of parenthesis in search

This commit is contained in:
Julien Fastré 2019-10-25 14:36:16 +02:00
parent f23aec0649
commit 0da029c4be
2 changed files with 8 additions and 0 deletions

View File

@ -85,3 +85,4 @@ Master branch
=============
- fix errors in pagination
- fix search: usage of parenthesis

View File

@ -76,7 +76,14 @@ abstract class AbstractSearch implements SearchInterface
foreach ($supportedTerms as $term) {
if (array_key_exists($term, $terms) && $term !== '_default') {
$recomposed .= ' '.$term.':';
$containsSpace = \strpos($terms[$term], " ") !== false;
if ($containsSpace) {
$recomposed .= "(";
}
$recomposed .= (mb_stristr(' ', $terms[$term]) === FALSE) ? $terms[$term] : '('.$terms[$term].')';
if ($containsSpace) {
$recomposed .= ")";
}
}
}