remove single char words

This commit is contained in:
ghost 2023-06-22 13:37:12 +03:00
parent e16a7b8171
commit 1c5346bc07

View File

@ -81,6 +81,19 @@ class Filter {
if ($mode == 'default') {
// Remove single char words
$words = [];
foreach ((array) explode(' ', $query) as $word) {
if (mb_strlen($word) > 1) {
$words[] = $word;
}
}
if ($words) {
$query = implode(' ', $words);
}
// Remove SphinxQL special chars
$query = str_replace(['\\', '/', '~', '@', '!', '"', '(', ')'], ['\\\\', '\/', '\~', '\@', '\!', '\"', '\(', '\)'], $query);