From: Sarah Hoffmann Date: Sun, 14 Oct 2012 14:09:12 +0000 (+0200) Subject: correct penalty for multi-word countries X-Git-Tag: deploy~667 X-Git-Url: https://git.openstreetmap.org./nominatim.git/commitdiff_plain/ea5c1ef26147ba4e4a06bbffdca54255fa037fcb?hp=-c correct penalty for multi-word countries Country name needs to be the final one within the wordset, not in the final of all wordsets. --- ea5c1ef26147ba4e4a06bbffdca54255fa037fcb diff --git a/website/search.php b/website/search.php index 59d57d58..c165b92b 100755 --- a/website/search.php +++ b/website/search.php @@ -421,12 +421,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(); @@ -450,7 +450,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; } }