Browse Source

fix MAYBE filter in the default search mode

main
ghost 2 years ago
parent
commit
edec590e09
  1. 7
      library/filter.php

7
library/filter.php

@ -85,9 +85,10 @@ class Filter {
$query = str_replace(['\\', '/', '~', '@', '!', '"', '(', ')'], ['\\\\', '\/', '\~', '\@', '\!', '\"', '\(', '\)'], $query); $query = str_replace(['\\', '/', '~', '@', '!', '"', '(', ')'], ['\\\\', '\/', '\~', '\@', '\!', '\"', '\(', '\)'], $query);
// Replace query separators to the MAYBE operator // Replace query separators to the MAYBE operator
$query = str_replace(['.', ',', ':', ';'], ' ', $query); $query = str_ireplace(['MAYBE'], ['__MAYBE__'], $query);
$query = preg_replace('/[\s]+/', ' ', $query); $query = preg_replace('/[\W\s]+/ui', '__SEPARATOR__', $query);
$query = str_replace(' ', ' MAYBE ', $query); $query = trim($query, '__SEPARATOR__');
$query = str_ireplace(['__SEPARATOR__', '__MAYBE__'], [' MAYBE ', ' \MAYBE '], $query);
} }
$query = trim($query); $query = trim($query);

Loading…
Cancel
Save