]> git.openstreetmap.org Git - nominatim.git/blobdiff - lib/SearchDescription.php
Keep matches without house number
[nominatim.git] / lib / SearchDescription.php
index 204a735885f8d3222e6ab1b5236e91f7f87a712f..bf32df9642e40a9fd03edae98f0554079bd86d29 100644 (file)
@@ -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;
                     }
                 }
             }