From 9d7c51a81332c3d10b6ca41e2f17f4ca2920738e Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Sun, 14 Oct 2012 16:09:12 +0200 Subject: [PATCH] correct penalty for multi-word countries Country name needs to be the final one within the wordset, not in the final of all wordsets. --- website/search.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/website/search.php b/website/search.php index 30f7abde..91869c3e 100755 --- a/website/search.php +++ b/website/search.php @@ -420,12 +420,12 @@ { $aNewPhraseSearches = array(); - foreach($aPhrases[$iPhrase]['wordsets'] as $iWordset => $aWordset) + foreach($aPhrases[$iPhrase]['wordsets'] as $aWordset) { $aWordsetSearches = $aSearches; // Add all words from this wordset - foreach($aWordset as $sToken) + foreach($aWordset as $iToken => $sToken) { //echo "
$sToken"; $aNewWordsetSearches = array(); @@ -449,7 +449,7 @@ { $aSearch['sCountryCode'] = strtolower($aSearchTerm['country_code']); // Country is almost always at the end of the string - increase score for finding it anywhere else (optimisation) - if ($iWordset+1 != sizeof($aPhrases[$iPhrase]['wordsets']) || $iPhrase+1 != sizeof($aPhrases)) $aSearch['iSearchRank'] += 5; + if ($iToken+1 != sizeof($aWordset) || $iPhrase+1 != sizeof($aPhrases)) $aSearch['iSearchRank'] += 5; if ($aSearch['iSearchRank'] < $iMaxRank) $aNewWordsetSearches[] = $aSearch; } }