From f9889f81d6916f1419e3913f7e3e4d90e2f0816e Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Wed, 5 Jan 2022 15:21:14 +0100 Subject: [PATCH] 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. --- lib-php/Geocode.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) 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 { -- 2.39.5