From e1fb7f8c17f8be55cac6922dd91794057b3bd981 Mon Sep 17 00:00:00 2001 From: ghost Date: Mon, 5 Jun 2023 23:33:07 +0300 Subject: [PATCH] change query separators to the MAYBE operator in default search mode --- library/filter.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/library/filter.php b/library/filter.php index 67bdf33..acfd56d 100644 --- a/library/filter.php +++ b/library/filter.php @@ -80,7 +80,14 @@ class Filter { static public function searchQuery(string $query, string $mode = 'default') { if ($mode == 'default') { + + // Remove SphinxQL special chars $query = str_replace(['\\', '/', '~', '@', '!', '"', '(', ')'], ['\\\\', '\/', '\~', '\@', '\!', '\"', '\(', '\)'], $query); + + // Replace query separators to the MAYBE operator + $query = str_replace(['.', ',', ':', ';'], ' ', $query); + $query = preg_replace('/[\s]+/', ' ', $query); + $query = str_replace(' ', ' MAYBE ', $query); } $query = trim($query);