From: Sarah Hoffmann Date: Fri, 18 Jan 2013 19:54:28 +0000 (+0100) Subject: allow country name at beginning for reverse order X-Git-Tag: v2.2.0~141 X-Git-Url: https://git.openstreetmap.org./nominatim.git/commitdiff_plain/b5671859660be6fefc45b3caf9cc783103d9bbc2 allow country name at beginning for reverse order --- diff --git a/website/search.php b/website/search.php index 5947fbc7..cea1ec03 100755 --- a/website/search.php +++ b/website/search.php @@ -533,7 +533,12 @@ { $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 ($iToken+1 != sizeof($aWordset) || $iPhrase+1 != sizeof($aPhrases)) $aSearch['iSearchRank'] += 5; + // If reverse order is enabled, it may appear at the beginning as well. + if (($iToken+1 != sizeof($aWordset) || $iPhrase+1 != sizeof($aPhrases)) && + (!$bReverseInPlan || $iToken > 0 || $iPhrase > 0)) + { + $aSearch['iSearchRank'] += 5; + } if ($aSearch['iSearchRank'] < $iMaxRank) $aNewWordsetSearches[] = $aSearch; } }