From: Sarah Hoffmann Date: Wed, 5 Jan 2022 14:21:14 +0000 (+0100) Subject: swap order of query interpretation X-Git-Tag: v4.1.0~101^2 X-Git-Url: https://git.openstreetmap.org./nominatim.git/commitdiff_plain/f9889f81d6916f1419e3913f7e3e4d90e2f0816e?ds=sidebyside swap order of query interpretation A forward interpretation of the form 'street, city, country' is much more frequent than the reverse form 'country, city, street'. Thus swap the order of interpretations that the forward order comes first. --- diff --git a/lib-php/Geocode.php b/lib-php/Geocode.php index 6d1d4596..bf9a3262 100644 --- a/lib-php/Geocode.php +++ b/lib-php/Geocode.php @@ -617,16 +617,15 @@ class Geocode } $aReverseGroupedSearches = $this->getGroupedSearches($aSearches, $aPhrases, $oValidTokens); - foreach ($aGroupedSearches as $aSearches) { + foreach ($aReverseGroupedSearches as $aSearches) { foreach ($aSearches as $aSearch) { - if (!isset($aReverseGroupedSearches[$aSearch->getRank()])) { - $aReverseGroupedSearches[$aSearch->getRank()] = array(); + if (!isset($aGroupedSearches[$aSearch->getRank()])) { + $aGroupedSearches[$aSearch->getRank()] = array(); } - $aReverseGroupedSearches[$aSearch->getRank()][] = $aSearch; + $aGroupedSearches[$aSearch->getRank()][] = $aSearch; } } - $aGroupedSearches = $aReverseGroupedSearches; ksort($aGroupedSearches); } } else {