]> git.openstreetmap.org Git - nominatim.git/blobdiff - lib/SearchDescription.php
print warning if no Tiger files found
[nominatim.git] / lib / SearchDescription.php
index 358e6969577f97ac52031c7bd10689572c405d6f..bb478b29b88af4fbcef3a174d8e5405cedd616ea 100644 (file)
@@ -447,8 +447,8 @@ class SearchDescription
                 $iLimit
             );
 
-            //now search for housenumber, if housenumber provided
-            if ($this->sHouseNumber && !empty($aResults)) {
+            // Now search for housenumber, if housenumber provided. Can be zero.
+            if (($this->sHouseNumber || $this->sHouseNumber === '0') && !empty($aResults)) {
                 // Downgrade the rank of the street results, they are missing
                 // the housenumber.
                 foreach ($aResults as $oRes) {
@@ -588,6 +588,9 @@ class SearchDescription
 
         $sSQL .= "p.postcode = '".reset($this->aName)."'";
         $sSQL .= $this->countryCodeSQL(' AND p.country_code');
+        if ($this->oContext->bViewboxBounded) {
+            $sSQL .= ' AND ST_Intersects('.$this->oContext->sqlViewboxSmall.', geometry)';
+        }
         $sSQL .= $this->oContext->excludeSQL(' AND p.place_id');
         $sSQL .= " LIMIT $iLimit";
 
@@ -657,10 +660,7 @@ class SearchDescription
             $aTerms[] = 'address_rank between 16 and 27';
         } elseif (!$this->sClass || $this->iOperator == Operator::NAME) {
             if ($iMinAddressRank > 0) {
-                $aTerms[] = 'address_rank >= '.$iMinAddressRank;
-            }
-            if ($iMaxAddressRank < 30) {
-                $aTerms[] = 'address_rank <= '.$iMaxAddressRank;
+                $aTerms[] = "((address_rank between $iMinAddressRank and $iMaxAddressRank) or (search_rank between $iMinAddressRank and $iMaxAddressRank))";
             }
         }