cvs: phpweb /include manual-lookup.inc

From: Date: Sat, 02 Jun 2007 20:26:20 +0000
Subject: cvs: phpweb /include manual-lookup.inc
Groups: php.mirrors 
Request: Send a blank email to php-mirrors+get-35597@lists.php.net to get a copy of this message
bjori Sat Jun 2 20:26:20 2007 UTC Modified files: /phpweb/include manual-lookup.inc Log: Fixed bug#37494 (saerch for CSV -> useless result) # Skip over metaphone() matches on short strings http://cvs.php.net/viewvc.cgi/phpweb/include/manual-lookup.inc?r1=1.26&r2=1.27&diff_format=u Index: phpweb/include/manual-lookup.inc diff -u phpweb/include/manual-lookup.inc:1.26 phpweb/include/manual-lookup.inc:1.27 --- phpweb/include/manual-lookup.inc:1.26 Sun May 20 11:29:22 2007 +++ phpweb/include/manual-lookup.inc Sat Jun 2 20:26:20 2007 @@ -1,6 +1,6 @@ <?php // -*- C++ -*- -// $Id: manual-lookup.inc,v 1.26 2007/05/20 11:29:22 bjori Exp $ +// $Id: manual-lookup.inc,v 1.27 2007/06/02 20:26:20 bjori Exp $ // We need this for error reporting include_once $_SERVER['DOCUMENT_ROOT'] . '/include/errors.inc'; @@ -132,7 +132,7 @@ // 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 @@ 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]; }

« previous php.mirrors (#35597) next »