]> git.openstreetmap.org Git - nominatim.git/commitdiff
handle 'order state level queries better
authorBrian Quinion <openstreetmap@brian.quinion.co.uk>
Mon, 23 May 2011 16:22:25 +0000 (16:22 +0000)
committerBrian Quinion <openstreetmap@brian.quinion.co.uk>
Mon, 23 May 2011 16:22:25 +0000 (16:22 +0000)
website/search.php

index fc03a58d7fbaf243f702bb6d1b688b216698d878..afce2ee25da8d8ff87c0de3ef28f5bf4b190db09 100755 (executable)
                                                                                // More efficient - can make the range bigger
                                                                                $fRange = 0.05;
                                                                                
-                                                                               $sSQL = "select l.place_id from place_classtype_".$aSearch['sClass']."_".$aSearch['sType']." as l";
+                                                                               $sSQL = "select distinct l.place_id from place_classtype_".$aSearch['sClass']."_".$aSearch['sType']." as l";
                                                                                if ($sCountryCodesSQL) $sSQL .= " join placex as lp using (place_id)";
                                                                                if ($sPlaceIDs)
                                                                                {
                                                                        else
                                                                        {
                                                                                if (isset($aSearch['fRadius']) && $aSearch['fRadius']) $fRange = $aSearch['fRadius'];
-                                                                               $sSQL = "select l.place_id from placex as l,placex as f where ";
+                                                                               $sSQL = "select distinct l.place_id from placex as l,placex as f where ";
                                                                                $sSQL .= "f.place_id in ( $sPlaceIDs) and ST_DWithin(l.geometry, st_centroid(f.geometry), $fRange) ";
                                                                                $sSQL .= "and l.class='".$aSearch['sClass']."' and l.type='".$aSearch['sType']."' ";
                                                                                if (sizeof($aExcludePlaceIDs))