change query separators to the MAYBE operator in default search mode

This commit is contained in:
ghost 2023-06-05 23:33:07 +03:00
parent 9379809261
commit e1fb7f8c17

View File

@ -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);