From 5f79cca558a49a4048d6ec3c179e68d0259f608e Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Wed, 3 Sep 2014 21:00:37 +0200 Subject: [PATCH] apply rank restrictions already when scanning search_name table fixes #176 --- lib/Geocode.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) 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'].")"; -- 2.39.5