X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/b612b9942109a08c6ff8f49e3327e015fec08e67..da7218350b42f6470d575b88b9e6bb72b6e65ee5:/lib/SearchDescription.php diff --git a/lib/SearchDescription.php b/lib/SearchDescription.php index 506d4202..33b766a5 100644 --- a/lib/SearchDescription.php +++ b/lib/SearchDescription.php @@ -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) { @@ -657,13 +657,10 @@ class SearchDescription } if ($this->sHouseNumber) { - $aTerms[] = 'address_rank between 16 and 27'; + $aTerms[] = 'address_rank between 16 and 30'; } 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))"; } }