]> git.openstreetmap.org Git - nominatim.git/blobdiff - lib/ReverseGeocode.php
faster query through bbox preselection
[nominatim.git] / lib / ReverseGeocode.php
index f720eea309a5fafc4ed9b7c7893426e06b8126ff..9576fafc14e91d4315cb9b9554aa4f185fdb9d41 100644 (file)
@@ -103,6 +103,8 @@ class ReverseGeocode
             $sSQL .= ' AND type != \'postcode\'';
             $sSQL .= ' AND name IS NOT NULL ';
             $sSQL .= ' and class not in (\'waterway\',\'railway\',\'tunnel\',\'bridge\',\'man_made\')';
             $sSQL .= ' AND type != \'postcode\'';
             $sSQL .= ' AND name IS NOT NULL ';
             $sSQL .= ' and class not in (\'waterway\',\'railway\',\'tunnel\',\'bridge\',\'man_made\')';
+            // preselection through bbox
+            $sSQL .= ' AND (SELECT geometry FROM placex WHERE place_id = '.$iPlaceID.') && geometry';
             $sSQL .= ' ORDER BY distance ASC,';
             $sSQL .= ' rank_address DESC';
             $sSQL .= ' limit 500) as a';
             $sSQL .= ' ORDER BY distance ASC,';
             $sSQL .= ' rank_address DESC';
             $sSQL .= ' limit 500) as a';