diff --git a/Classes/Eel/ElasticSearchQueryBuilder.php b/Classes/Eel/ElasticSearchQueryBuilder.php index 6c9c4917..5114cebc 100644 --- a/Classes/Eel/ElasticSearchQueryBuilder.php +++ b/Classes/Eel/ElasticSearchQueryBuilder.php @@ -684,8 +684,11 @@ public function count(): int */ public function fulltext(string $searchWord, array $options = []): QueryBuilderInterface { + $encodedSearchWord = json_encode($searchWord, JSON_THROW_ON_ERROR | JSON_UNESCAPED_UNICODE); + // remove quotes added by json_encode + $encodedSearchWord = \substr($encodedSearchWord, 1, \strlen($encodedSearchWord)-2); // We automatically enable result highlighting when doing fulltext searches. It is up to the user to use this information or not use it. - $this->request->fulltext(trim(json_encode($searchWord, JSON_THROW_ON_ERROR | JSON_UNESCAPED_UNICODE), '"'), $options); + $this->request->fulltext($encodedSearchWord, $options); $this->request->highlight(150, 2); return $this;