From 62624d8f572364189ef82200185bb079309891dd Mon Sep 17 00:00:00 2001 From: Hannes Magnusson Date: Sat, 2 Jun 2007 20:26:20 +0000 Subject: [PATCH] Fixed bug#37494 (saerch for CSV -> useless result) # Skip over metaphone() matches on short strings --- include/manual-lookup.inc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/include/manual-lookup.inc b/include/manual-lookup.inc index 59e954b9b..3966bca47 100644 --- a/include/manual-lookup.inc +++ b/include/manual-lookup.inc @@ -132,7 +132,7 @@ function find_manual_page($lang, $keyword) // List of all the keywords in single quotes $words = "'" . implode("','", $keywords) . "'"; - $SQL = "SELECT name FROM fs WHERE lang = 'LANG_HERE' + $SQL = "SELECT name, prio FROM fs WHERE lang = 'LANG_HERE' AND keyword IN (" . $words . ") ORDER BY prio LIMIT 1"; } @@ -144,6 +144,11 @@ function find_manual_page($lang, $keyword) if ($q) { $r = sqlite_fetch_array($q, SQLITE_NUM); if (isset($r[0])) { + if($r[1] > 10 && strlen($keyword) < 4) { + // "Match" found, but the keyword is so short + // its probably bogus. Skip it + continue; + } // Match found return $r[0]; }