X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/9908c93d4cec91b5109d4fbc83dde18b5076350f..ec4e3c36af238ae3c31a2f5eb727fe2a22f6d054:/lib/SearchDescription.php diff --git a/lib/SearchDescription.php b/lib/SearchDescription.php index 204a7358..bf32df96 100644 --- a/lib/SearchDescription.php +++ b/lib/SearchDescription.php @@ -448,13 +448,17 @@ class SearchDescription //now search for housenumber, if housenumber provided if ($this->sHouseNumber && !empty($aResults)) { - $aNamedPlaceIDs = $aResults; - $aResults = $this->queryHouseNumber($oDB, $aNamedPlaceIDs); + // Downgrade the rank of the street results, they are missing + // the housenumber. + foreach ($aResults as $oRes) { + $oRes->iResultRank++; + } + + $aHnResults = $this->queryHouseNumber($oDB, $aResults); - if (empty($aResults) && $this->looksLikeFullAddress()) { - $aResults = $aNamedPlaceIDs; - foreach ($aResults as $oRes) { - $oRes->iResultRank++; + if (!empty($aHnResults)) { + foreach ($aHnResults as $oRes) { + $aResults[$oRes->iId] = $oRes; } } }