X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/db3ced17bbfff00411f506d8c84419c875959d5e..c678cd1572bc3b15bb8ffa369bb63905718bd0fa:/lib-php/SearchDescription.php?ds=sidebyside diff --git a/lib-php/SearchDescription.php b/lib-php/SearchDescription.php index 2053082f..ea9d7f58 100644 --- a/lib-php/SearchDescription.php +++ b/lib-php/SearchDescription.php @@ -450,7 +450,11 @@ class SearchDescription // Downgrade the rank of the street results, they are missing // the housenumber. foreach ($aResults as $oRes) { - $oRes->iResultRank++; + if ($oRes->iAddressRank >= 26) { + $oRes->iResultRank++; + } else { + $oRes->iResultRank += 2; + } } $aHnResults = $this->queryHouseNumber($oDB, $aResults); @@ -715,7 +719,7 @@ class SearchDescription $aResults = array(); if (!empty($aTerms)) { - $sSQL = 'SELECT place_id,'.$sExactMatchSQL; + $sSQL = 'SELECT place_id, address_rank,'.$sExactMatchSQL; $sSQL .= ' FROM search_name'; $sSQL .= ' WHERE '.join(' and ', $aTerms); $sSQL .= ' ORDER BY '.join(', ', $aOrder); @@ -728,6 +732,7 @@ class SearchDescription foreach ($aDBResults as $aResult) { $oResult = new Result($aResult['place_id']); $oResult->iExactMatches = $aResult['exactmatch']; + $oResult->iAddressRank = $aResult['address_rank']; $aResults[$aResult['place_id']] = $oResult; } }