X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/db3ced17bbfff00411f506d8c84419c875959d5e..ccfad57fcab0559ad780f9c703c6e059e7e359ad:/lib-php/Geocode.php diff --git a/lib-php/Geocode.php b/lib-php/Geocode.php index 12f9da37..b475add2 100644 --- a/lib-php/Geocode.php +++ b/lib-php/Geocode.php @@ -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'];