From: Sarah Hoffmann Date: Wed, 3 Sep 2014 19:00:37 +0000 (+0200) Subject: apply rank restrictions already when scanning search_name table X-Git-Tag: v2.3.0~15 X-Git-Url: https://git.openstreetmap.org./nominatim.git/commitdiff_plain/5f79cca558a49a4048d6ec3c179e68d0259f608e apply rank restrictions already when scanning search_name table fixes #176 --- diff --git a/lib/Geocode.php b/lib/Geocode.php index 7563a26d..6d579622 100644 --- a/lib/Geocode.php +++ b/lib/Geocode.php @@ -1262,7 +1262,21 @@ } } if ($aSearch['sCountryCode']) $aTerms[] = "country_code = '".pg_escape_string($aSearch['sCountryCode'])."'"; - if ($aSearch['sHouseNumber']) $aTerms[] = "address_rank between 16 and 27"; + if ($aSearch['sHouseNumber']) + { + $aTerms[] = "address_rank between 16 and 27"; + } + else + { + if ($this->iMinAddressRank > 0) + { + $aTerms[] = "address_rank >= ".$this->iMinAddressRank; + } + if ($this->iMaxAddressRank < 30) + { + $aTerms[] = "address_rank <= ".$this->iMaxAddressRank; + } + } if ($aSearch['fLon'] && $aSearch['fLat']) { $aTerms[] = "ST_DWithin(centroid, ST_SetSRID(ST_Point(".$aSearch['fLon'].",".$aSearch['fLat']."),4326), ".$aSearch['fRadius'].")";