X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/4f3074e5388614f52b44f2db5fddc56141a35998..b27926fd4d96e0bcb0471543e4f29c14752f43e2:/lib/Geocode.php diff --git a/lib/Geocode.php b/lib/Geocode.php index c234c5f2..03df6752 100644 --- a/lib/Geocode.php +++ b/lib/Geocode.php @@ -477,12 +477,13 @@ class Geocode $sHousenumbers .= "(".$placeID.", ".$housenumber.")"; if ($i<$length) $sHousenumbers .= ", "; } + if (CONST_Use_US_Tiger_Data) { // Tiger search only if a housenumber was searched and if it was found (i.e. aPlaceIDs[placeID] = housenumber != -1) (realized through a join) $sSQL .= " union"; $sSQL .= " SELECT "; $sSQL .= " 'T' AS osm_type, "; - $sSQL .= " place_id AS osm_id, "; + $sSQL .= " (SELECT osm_id from placex p WHERE p.place_id=min(blub.parent_place_id)) as osm_id, "; $sSQL .= " 'place' AS class, "; $sSQL .= " 'house' AS type, "; $sSQL .= " null AS admin_level, "; @@ -532,7 +533,7 @@ class Geocode $sSQL .= " UNION "; $sSQL .= "SELECT "; $sSQL .= " 'W' AS osm_type, "; - $sSQL .= " place_id AS osm_id, "; + $sSQL .= " osm_id, "; $sSQL .= " 'place' AS class, "; $sSQL .= " 'house' AS type, "; $sSQL .= " null AS admin_level, "; @@ -563,6 +564,7 @@ class Geocode $sSQL .= " null AS extra_place "; $sSQL .= " FROM ("; $sSQL .= " SELECT "; + $sSQL .= " osm_id, "; $sSQL .= " place_id, "; $sSQL .= " calculated_country_code, "; $sSQL .= " CASE "; // interpolate the housenumbers here @@ -906,6 +908,9 @@ class Geocode } $sQuery = $this->sQuery; + if (!preg_match('//u', $sQuery)) { + userError("Query string is not UTF-8 encoded."); + } // Conflicts between US state abreviations and various words for 'the' in different languages if (isset($this->aLangPrefOrder['name:en'])) {