Skip to content

Commit 18d16f2

Browse files
committed
BUGFIX: Avoid errors with special chars in term suggestion
1 parent b350203 commit 18d16f2

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

Classes/Controller/SuggestController.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ protected function buildRequestForTerm($contextNodeIdentifier, $dimensionCombina
9393
$term = strtolower($term);
9494

9595
// The suggest function only works well with one word
96-
$suggestTerm = explode(' ', $term)[0];
96+
// and the term is trimmed to alnum characters to avoid errors
97+
$suggestTerm = preg_replace('/[[:^alnum:]]/', '', explode(' ', $term)[0]);
9798

9899
if(!$this->elasticSearchQueryTemplateCache->has($cacheKey)) {
99100
$contentContext = $this->createContentContext('live', json_decode($dimensionCombination, true));

0 commit comments

Comments
 (0)