Module: appdb Branch: master Commit: 504817d08f5e2336f7ac79f102a2577924ab1fc3 URL: http://source.winehq.org/git/appdb.git/?a=commit;h=504817d08f5e2336f7ac79f10...
Author: Alexander Nicolaysen Sørnes alex@thehandofagony.com Date: Tue Jul 8 21:23:07 2008 +0200
Find more duplicates in partial searches
---
include/util.php | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/include/util.php b/include/util.php index fe80fc3..6fe6c1c 100644 --- a/include/util.php +++ b/include/util.php @@ -430,6 +430,8 @@ function searchForApplicationPartial($sSearchWords) $sSearchWords = cleanupSearchWords($sSearchWords); $aWords = explode(' ', $sSearchWords); $sSearchString = ''; + $sEnsureExactWord = ''; // Used to ensure we don't match partial words when prepending + // a wildcard to the search string
for($i = 0; $i < sizeof($aWords); $i++) { @@ -439,13 +441,13 @@ function searchForApplicationPartial($sSearchWords) if(strlen($aWords[$i]) > 4) { if($i < (sizeof($aWords) - 1)) - $sSearchString .= ' '; + $sEnsureExactWord = ' '; break; } }
$hResult = query_parameters("SELECT * FROM appFamily WHERE state = 'accepted' AND - appName LIKE '?%'", $sSearchString); + (appName LIKE '?%' OR appName LIKE '?')", $sSearchString.$sEnsureExactWord, $sSearchString);
return $hResult; }