diff options
author | Steven Wittens <steven@10.no-reply.drupal.org> | 2004-10-15 22:01:41 +0000 |
---|---|---|
committer | Steven Wittens <steven@10.no-reply.drupal.org> | 2004-10-15 22:01:41 +0000 |
commit | a35ff36673ed392b0c753b7298cf4dd3b39f06dc (patch) | |
tree | 7bc6c7a5e123ed4cba2ac17e63fdf4d6207ab504 /modules | |
parent | 7cf0e9af33b1b7a224b91509929a9bfc3ced00d4 (diff) | |
download | brdo-a35ff36673ed392b0c753b7298cf4dd3b39f06dc.tar.gz brdo-a35ff36673ed392b0c753b7298cf4dd3b39f06dc.tar.bz2 |
search: Removing iso-8859-1 characters from update_index() and adding the same stripping to do_search().
This fixes the embarrasing bug of not being able to search for "4.5.0" because it is indexed as "450".
Diffstat (limited to 'modules')
-rw-r--r-- | modules/search.module | 7 | ||||
-rw-r--r-- | modules/search/search.module | 7 |
2 files changed, 10 insertions, 4 deletions
diff --git a/modules/search.module b/modules/search.module index a4fe6dd44..04b0630c4 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 a4fe6dd44..04b0630c4 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); |