diff --git a/modules/search.module b/modules/search.module index a4fe6dd44af0269b6530aa730fdaedbd5d512926..04b0630c4975f8e4f3fb097eb8232602760681f2 100644 --- a/modules/search.module +++ b/modules/search.module @@ -128,6 +128,9 @@ function do_search($search_array) { $type = $search_array['type']; $select = $search_array['select']; + // Remove punctuation/special characters (same rule as update_index()). + $keys = preg_replace("'(!|%|,|:|;|\(|\)|\&|\"|\'|\.|-|\/|\?|\\\)'", '', $keys); + // Replace wildcards with MySQL wildcards. $keys = str_replace('*', '%', $keys); @@ -259,8 +262,8 @@ function update_index($search_array) { // Strip heaps of stuff out of it. $wordlist = preg_replace("'<[\/\!]*?[^<>]*?>'si", '', $wordlist); - // Remove punctuation/special characters. - $wordlist = preg_replace("'(\xBB|\xAB|!|\xA1|%|,|:|;|\(|\)|\&|\"|\'|\.|-|\/|\?|\\\)'", '', $wordlist); + // Remove punctuation/special characters (same rule as do_search()). + $keys = preg_replace("'(!|%|,|:|;|\(|\)|\&|\"|\'|\.|-|\/|\?|\\\)'", '', $keys); // Strip out (now mangled) http and tags. $wordlist = preg_replace("'http\w+'", '', $wordlist); diff --git a/modules/search/search.module b/modules/search/search.module index a4fe6dd44af0269b6530aa730fdaedbd5d512926..04b0630c4975f8e4f3fb097eb8232602760681f2 100644 --- a/modules/search/search.module +++ b/modules/search/search.module @@ -128,6 +128,9 @@ function do_search($search_array) { $type = $search_array['type']; $select = $search_array['select']; + // Remove punctuation/special characters (same rule as update_index()). + $keys = preg_replace("'(!|%|,|:|;|\(|\)|\&|\"|\'|\.|-|\/|\?|\\\)'", '', $keys); + // Replace wildcards with MySQL wildcards. $keys = str_replace('*', '%', $keys); @@ -259,8 +262,8 @@ function update_index($search_array) { // Strip heaps of stuff out of it. $wordlist = preg_replace("'<[\/\!]*?[^<>]*?>'si", '', $wordlist); - // Remove punctuation/special characters. - $wordlist = preg_replace("'(\xBB|\xAB|!|\xA1|%|,|:|;|\(|\)|\&|\"|\'|\.|-|\/|\?|\\\)'", '', $wordlist); + // Remove punctuation/special characters (same rule as do_search()). + $keys = preg_replace("'(!|%|,|:|;|\(|\)|\&|\"|\'|\.|-|\/|\?|\\\)'", '', $keys); // Strip out (now mangled) http and tags. $wordlist = preg_replace("'http\w+'", '', $wordlist);