mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-22 06:13:58 -07:00
Update functions.php
This commit is contained in:
parent
80fd0524b5
commit
b063c13d74
1 changed files with 14 additions and 4 deletions
|
@ -1768,13 +1768,23 @@ function clean_text_match($text, $ltrim_star = true, $die_if_empty = false)
|
||||||
|
|
||||||
$text = ' ' . str_compact(ltrim($text, $ltrim_chars)) . ' ';
|
$text = ' ' . str_compact(ltrim($text, $ltrim_chars)) . ' ';
|
||||||
|
|
||||||
if ($bb_cfg['search_engine_type'] == 'sphinx') {
|
if ($bb_cfg['search_engine_type'] == 'manticore') {
|
||||||
$text = preg_replace('#(?<=\S)\-#u', ' ', $text); // "1-2-3" -> "1 2 3"
|
$text = preg_replace('#(?<=\S)\-#u', ' ', $text); // "1-2-3" -> "1 2 3"
|
||||||
$text = preg_replace('#[^0-9a-zA-Zа-яА-ЯёЁ\-_*|]#u', ' ', $text); // valid characters (except '"' which are separate)
|
$text = preg_replace('#[^0-9a-zA-Zа-яА-ЯёЁ\-_*|@]#u', ' ', $text); // валидные символы + @ для email поиска
|
||||||
$text = str_replace(['-', '*'], [' -', '* '], $text); // only at the beginning/end of a word
|
$text = str_replace(['-', '*'], [' -', '* '], $text);
|
||||||
$text = preg_replace('#\s*\|\s*#u', '|', $text); // "| " -> "|"
|
$text = preg_replace('#\s*\|\s*#u', '|', $text); // "| " -> "|"
|
||||||
$text = preg_replace('#\|+#u', ' | ', $text); // "||" -> "|"
|
$text = preg_replace('#\|+#u', ' | ', $text); // "||" -> "|"
|
||||||
$text = preg_replace('#(?<=\s)[\-*]+\s#u', ' ', $text); // single " - ", " * "
|
$text = preg_replace('#(?<=\s)[\-*]+\s#u', ' ', $text); // удаление одиночных " - ", " * "
|
||||||
|
$text = trim($text, ' -|');
|
||||||
|
$text = str_compact($text);
|
||||||
|
$text_match_sql = ($wrap_with_quotes && $text != '') ? '"' . $text . '"' : $text;
|
||||||
|
} elseif ($bb_cfg['search_engine_type'] == 'sphinx') {
|
||||||
|
$text = preg_replace('#(?<=\S)\-#u', ' ', $text);
|
||||||
|
$text = preg_replace('#[^0-9a-zA-Zа-яА-ЯёЁ\-_*|]#u', ' ', $text);
|
||||||
|
$text = str_replace(['-', '*'], [' -', '* '], $text);
|
||||||
|
$text = preg_replace('#\s*\|\s*#u', '|', $text);
|
||||||
|
$text = preg_replace('#\|+#u', ' | ', $text);
|
||||||
|
$text = preg_replace('#(?<=\s)[\-*]+\s#u', ' ', $text);
|
||||||
$text = trim($text, ' -|');
|
$text = trim($text, ' -|');
|
||||||
$text = str_compact($text);
|
$text = str_compact($text);
|
||||||
$text_match_sql = ($wrap_with_quotes && $text != '') ? '"' . $text . '"' : $text;
|
$text_match_sql = ($wrap_with_quotes && $text != '') ? '"' . $text . '"' : $text;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue