Commit a35ff366 authored by Steven Wittens's avatar Steven Wittens

search: Removing iso-8859-1 characters from update_index() and adding the same...

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".
parent 7cf0e9af
......@@ -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);
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment