Skip to content

Commit 82755c9

Browse files
author
Sebastian Helzle
authored
Merge pull request #6 from kdambekalns/improvement-suggestions
BUGFIX: Avoid errors with special chars in term suggestion
2 parents e7862df + 18d16f2 commit 82755c9

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)