Skip to content

Commit

Permalink
swap order of query interpretation
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
lonvia committed Jan 5, 2022
1 parent efafa52 commit f9889f8
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions lib-php/Geocode.php
Expand Up @@ -617,16 +617,15 @@ public function lookup()
}
$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 {
Expand Down

0 comments on commit f9889f8

Please sign in to comment.