]> git.openstreetmap.org Git - nominatim.git/commitdiff
apply rank restrictions already when scanning search_name table
authorSarah Hoffmann <lonvia@denofr.de>
Wed, 3 Sep 2014 19:00:37 +0000 (21:00 +0200)
committerSarah Hoffmann <lonvia@denofr.de>
Wed, 3 Sep 2014 19:00:37 +0000 (21:00 +0200)
fixes #176

lib/Geocode.php

index 7563a26d54e326691ccb982b39124832abcf23dd..6d5796228d13eeca69dc99a2ca0b5229f8321d30 100644 (file)
                                                                }
                                                        }
                                                        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'].")";