From 1f27a7e105d4358498819aeefe3607e833bcdc8a Mon Sep 17 00:00:00 2001 From: ghost Date: Sun, 25 Feb 2024 09:11:12 +0200 Subject: [PATCH] trim extra spaces before query escape --- src/webui/search.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/webui/search.php b/src/webui/search.php index d6c6740..de68d38 100644 --- a/src/webui/search.php +++ b/src/webui/search.php @@ -140,15 +140,17 @@ switch (true) // http://sphinxsearch.com/docs/current/extended-syntax.html else { - // Escape special chars - $q = @\Manticoresearch\Utils::escape( - $q + // Remove separator duplicates + $q = trim( + preg_replace( + '/[\s]+/ui', + ' ', + $q + ) ); - // Remove separator duplicates - $q = preg_replace( - '/[\s]+/ui', - ' ', + // Escape special chars + $q = @\Manticoresearch\Utils::escape( $q );