From 020a8a46f8841d53f7b6b0e4bec144d3e8871a3b Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sun, 15 Jan 2006 08:42:48 +0000 Subject: [PATCH] r725: Check for MySQL minimum word length --- search.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/search.php b/search.php index 6a5d782..d12630b 100644 --- a/search.php +++ b/search.php @@ -32,7 +32,8 @@ define('MODE_ANY', ($bugsys->in['mode'] == 1)); define('MODE_ALL', ($bugsys->in['mode'] == 2)); define('MODE_RAW', ($bugsys->in['mode'] == 3)); -define('SEARCH_WORD_MIN', 3); +$var = $db->query_first("SHOW VARIABLES LIKE 'ft_min_word_len'"); +define('SEARCH_WORD_MIN', $var['Value']); $show['search'] = true; @@ -46,7 +47,7 @@ if (empty($_REQUEST['do'])) // ################################################################### if ($_REQUEST['do'] == 'process') -{ +{ // ------------------------------------------------------------------- // handle keywords if ($bugsys->in['summary']) @@ -54,7 +55,6 @@ if ($_REQUEST['do'] == 'process') $keywords = preg_split('#\s+#', $bugsys->in['summary']); // #*# need to have some str to bool conversions - // #*# need to make sure the word isn't on MySQL's bad side (less than 3 chars. and not a common word) foreach ($keywords AS $word) { @@ -226,7 +226,7 @@ if ($_REQUEST['do'] == 'process') // have to search something if (count($querybuild) < 1) { - $message->error($lang->string('You have to enter some criteria to search for')); + $message->error(sprintf($lang->string('You have to enter some criteria to search for. Node that words less than %1$d characters are ignored by the search engine (and some other very common words, too).'), SEARCH_WORD_MIN)); } // ------------------------------------------------------------------- -- 2.22.5