From: Sarah Hoffmann Date: Thu, 3 Jan 2019 20:51:59 +0000 (+0100) Subject: Merge remote-tracking branch 'upstream/master' X-Git-Tag: deploy~300 X-Git-Url: https://git.openstreetmap.org./nominatim.git/commitdiff_plain/f00baba40c6f73ba8e637ac4cea60d59a11692f4?ds=inline;hp=-c Merge remote-tracking branch 'upstream/master' --- f00baba40c6f73ba8e637ac4cea60d59a11692f4 diff --combined lib/Geocode.php index 5343873f,8b153d9a..b176701c --- a/lib/Geocode.php +++ b/lib/Geocode.php @@@ -18,7 -18,7 +18,7 @@@ class Geocod protected $aLangPrefOrder = array(); protected $aExcludePlaceIDs = array(); - protected $bReverseInPlan = false; + protected $bReverseInPlan = true; protected $iLimit = 20; protected $iFinalLimit = 10; @@@ -758,13 -758,22 +758,22 @@@ $oValidTokens->debugTokenByWordIdList() ); - $aResults += $oSearch->query( + $aNewResults = $oSearch->query( $this->oDB, $this->iMinAddressRank, $this->iMaxAddressRank, $this->iLimit ); + // The same result may appear in different rounds, only + // use the one with minimal rank. + foreach ($aNewResults as $iPlace => $oRes) { + if (!isset($aResults[$iPlace]) + || $aResults[$iPlace]->iResultRank > $oRes->iResultRank) { + $aResults[$iPlace] = $oRes; + } + } + if ($iQueryLoop > 20) break; }