]> git.openstreetmap.org Git - nominatim.git/commitdiff
Merge remote-tracking branch 'upstream/master'
authorSarah Hoffmann <lonvia@denofr.de>
Thu, 3 Jan 2019 20:51:59 +0000 (21:51 +0100)
committerSarah Hoffmann <lonvia@denofr.de>
Thu, 3 Jan 2019 20:51:59 +0000 (21:51 +0100)
1  2 
lib/Geocode.php

diff --combined lib/Geocode.php
index 5343873fb9d59bdd8987954f7f20692bc0866be3,8b153d9a2d59a18497d25fd5a9c0c72c46e64085..b176701c02ef2b4ee28e18956db656996bb2edbc
@@@ -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;
                          $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;
                  }