X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/db3ced17bbfff00411f506d8c84419c875959d5e..2fb6018078188239a42c35327431c2becd4a3611:/lib-php/Geocode.php diff --git a/lib-php/Geocode.php b/lib-php/Geocode.php index 12f9da37..f638af9a 100644 --- a/lib-php/Geocode.php +++ b/lib-php/Geocode.php @@ -778,14 +778,19 @@ class Geocode if (!empty($aResults)) { $aSplitResults = Result::splitResults($aResults); Debug::printVar('Split results', $aSplitResults); - if ($iGroupLoop <= 4 && empty($aSplitResults['tail']) - && reset($aSplitResults['head'])->iResultRank > 0) { + if ($iGroupLoop <= 4 + && reset($aSplitResults['head'])->iResultRank > 0 + && $iGroupedRank !== array_key_last($aGroupedSearches)) { // Haven't found an exact match for the query yet. // Therefore add result from the next group level. $aNextResults = $aSplitResults['head']; foreach ($aNextResults as $oRes) { $oRes->iResultRank--; } + foreach ($aSplitResults['tail'] as $oRes) { + $oRes->iResultRank--; + $aNextResults[$oRes->iId] = $oRes; + } $aResults = array(); } else { $aResults = $aSplitResults['head'];