diff options
author | Bart van Bragt <bartvb@users.sourceforge.net> | 2002-01-03 11:06:22 +0000 |
---|---|---|
committer | Bart van Bragt <bartvb@users.sourceforge.net> | 2002-01-03 11:06:22 +0000 |
commit | f02324d2cb243a1ba293b6eeb66c6eeff343edc0 (patch) | |
tree | 1d0d91fa98faeb434bc77486e77cff850353c908 /phpBB/search.php | |
parent | 6c8b10c87a50b03d4e9c7f933b53dce6350cc918 (diff) | |
download | forums-f02324d2cb243a1ba293b6eeb66c6eeff343edc0.tar forums-f02324d2cb243a1ba293b6eeb66c6eeff343edc0.tar.gz forums-f02324d2cb243a1ba293b6eeb66c6eeff343edc0.tar.bz2 forums-f02324d2cb243a1ba293b6eeb66c6eeff343edc0.tar.xz forums-f02324d2cb243a1ba293b6eeb66c6eeff343edc0.zip |
Moved all search functions to includes/search.php Paul; please review
git-svn-id: file:///svn/phpbb/trunk@1781 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/search.php')
-rw-r--r-- | phpBB/search.php | 77 |
1 files changed, 1 insertions, 76 deletions
diff --git a/phpBB/search.php b/phpBB/search.php index f1526e200e..ba03b967df 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -24,82 +24,7 @@ $phpbb_root_path = "./"; include($phpbb_root_path . 'extension.inc'); include($phpbb_root_path . 'common.'.$phpEx); include($phpbb_root_path . 'includes/bbcode.'.$phpEx); - -// ----------------------- -// Page specific functions -// -function clean_words_search($entry) -{ - - $char_match = array("^", "$", "&", "(", ")", "<", ">", "`", "'", "|", ",", "@", "_", "?", "%", "~", ".", "[", "]", "{", "}", ":", "\\", "/", "=", "#", "\"", ";", "!"); - $char_replace = array(" ", " ", " ", " ", " ", " ", " ", " ", "", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "); - - $sgml_match = array(" ", "ß", "à", "á", "â", "ã", "ä", "å", "æ", "ç", "è", "é", "ê", "ë", "ì", "í", "î", "ï", "ð", "ñ", "ò", "ó", "ô", "õ", "ö", "ø", "ù", "ú", "û", "ü", "ý", "þ", "ÿ"); - $sgml_replace = array(" ", "s", "a", "a", "a", "a", "a", "a", "a", "c", "e", "e", "e", "e", "i", "i", "i", "i", "o", "n", "o", "o", "o", "o", "o", "o", "u", "u", "u", "u", "y", "t", "y"); - - $accent_match = array("ß", "à", "á", "â", "ã", "ä", "å", "æ", "ç", "è", "é", "ê", "ë", "ì", "í", "î", "ï", "ð", "ñ", "ò", "ó", "ô", "õ", "ö", "ø", "ù", "ú", "û", "ü", "ý", "þ", "ÿ"); - $accent_replace = array("s", "a", "a", "a", "a", "a", "a", "a", "c", "e", "e", "e", "e", "i", "i", "i", "i", "o", "n", "o", "o", "o", "o", "o", "o", "u", "u", "u", "u", "y", "t", "y"); - - $entry = " " . strip_tags(strtolower($entry)) . " "; - - $entry = str_replace("+", " and ", $entry); - $entry = str_replace("-", " not ", $entry); - - $entry = str_replace($sgml_match, $sgml_match, $entry); - $entry = str_replace($accent_match, $accent_replace, $entry); - $entry = str_replace($char_match, $char_replace, $entry); - - $entry = preg_replace("/\b[0-9]+\b/", " ", $entry); - - return $entry; -} - -function remove_stop_words($entry, &$stopword_list) -{ - - if( !empty($stopword_list) ) - { - for ($j = 0; $j < count($stopword_list); $j++) - { - $filter_word = trim(strtolower($stopword_list[$j])); - if( $filter_word != "and" && $filter_word != "or" && $filter_word != "not" ) - { - $entry = preg_replace("/\b" . phpbb_preg_quote($filter_word, "/") . "\b/is", " ", $entry); - } - } - } - - return $entry; -} - -function replace_synonyms($entry, &$synonym_list) -{ - if( !empty($synonym_list) ) - { - for ($j = 0; $j < count($synonym_list); $j++) - { - list($replace_synonym, $match_synonym) = split(" ", trim(strtolower($synonym_list[$j]))); - - if( $match_synonym != "and" && $match_synonym != "or" && $match_synonym != "not" && - $replace_synonym != "and" && $replace_synonym != "or" && $replace_synonym != "not" ) - { - $entry = preg_replace("/\b" . phpbb_preg_quote(trim($match_synonym), "/") . "\b/is", " " . trim($replace_synonym) . " ", $entry); - } - } - } - - return $entry; -} - -function split_words(&$entry) -{ - preg_match_all("/(\*?[a-z0-9]+\*?)|\b([a-z0-9]+)\b/is", $entry, $split_entries); - - return $split_entries[1]; -} -// -// End of functions defns -// ---------------------- +include($phpbb_root_path . 'includes/search.'.$phpEx); // // Start session management |