]> git.openstreetmap.org Git - nominatim.git/blobdiff - lib-php/Geocode.php
Merge pull request #2181 from lonvia/port-more-tool-functions-to-python
[nominatim.git] / lib-php / Geocode.php
index 12f9da37550f856e47a128641a275813d9c4e9de..b475add22e8eefaf3cd85d0cbc85c46e7c66bc98 100644 (file)
@@ -778,7 +778,7 @@ class Geocode
                 if (!empty($aResults)) {
                     $aSplitResults = Result::splitResults($aResults);
                     Debug::printVar('Split results', $aSplitResults);
-                    if ($iGroupLoop <= 4 && empty($aSplitResults['tail'])
+                    if ($iGroupLoop <= 4
                         && reset($aSplitResults['head'])->iResultRank > 0) {
                         // Haven't found an exact match for the query yet.
                         // Therefore add result from the next group level.
@@ -786,6 +786,10 @@ class Geocode
                         foreach ($aNextResults as $oRes) {
                             $oRes->iResultRank--;
                         }
+                        foreach ($aSplitResults['tail'] as $oRes) {
+                            $oRes->iResultRank--;
+                            $aNextResults[$oRes->iId] = $oRes;
+                        }
                         $aResults = array();
                     } else {
                         $aResults = $aSplitResults['head'];