From 3549798801421069bbc7a25f6f7b556419a437eb Mon Sep 17 00:00:00 2001 From: Daniel Lienert Date: Mon, 12 Jul 2021 16:33:25 +0200 Subject: [PATCH] BUGFIX: Remove special characters completely MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit According to https://lucene.apache.org/core/3_4_0/queryparsersyntax.html#Escaping%20Special%20Characters, special characters should be escapeable using a „\“ character. Sadly because of some internal json encoding this doesn’t work properly. Any of these characters break the query. --- Classes/Utility/SearchTerm.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Classes/Utility/SearchTerm.php b/Classes/Utility/SearchTerm.php index 9b70fa3..a008b2b 100644 --- a/Classes/Utility/SearchTerm.php +++ b/Classes/Utility/SearchTerm.php @@ -18,7 +18,7 @@ class SearchTerm public static function sanitizeSearchInput(string $input): string { - return str_replace(['=', '>', '<', '(', ')', '{', '}', '[', ']', '^', '"', '~', '*', '?', ':', '\\', '/'], ['', '', '', '(', '\)', '\{', '\}', '\[', '\]', '\^', '\"', '\~', '\*', '\?', '\:', '\\\\', '\/'], $input); + return str_replace(['\\', '=', '>', '<', '(', ')', '{', '}', '[', ']', '^', '"', '~', '*', '?', ':', '/'], '', $input); } }