]> git.openstreetmap.org Git - nominatim.git/commitdiff
Merge remote-tracking branch 'upstream/master'
authorSarah Hoffmann <lonvia@denofr.de>
Wed, 7 Jun 2017 21:26:24 +0000 (23:26 +0200)
committerSarah Hoffmann <lonvia@denofr.de>
Wed, 7 Jun 2017 21:26:24 +0000 (23:26 +0200)
1  2 
sql/functions.sql

diff --combined sql/functions.sql
index d3207843906db0312640f2034a01bfba6fb3a9ed,77af9263e3b483430f66bbe6ee6722d2b40f8d2f..d55b0d652f5ad24faf42446b1ec13340016821b7
@@@ -1492,7 -1492,8 +1492,8 @@@ BEGI
        FOR relMember IN select get_osm_rel_members(relation_members,ARRAY['label']) as member LOOP
  
          FOR linkedPlacex IN select * from placex where osm_type = upper(substring(relMember.member,1,1))::char(1) 
-           and osm_id = substring(relMember.member,2,10000)::bigint order by rank_search desc limit 1 LOOP
+           and osm_id = substring(relMember.member,2,10000)::bigint
+           and class = 'place' order by rank_search desc limit 1 LOOP
  
            -- If we don't already have one use this as the centre point of the geometry
            IF NEW.centroid IS NULL THEN
          FOR relMember IN select get_osm_rel_members(relation_members,ARRAY['admin_center','admin_centre']) as member LOOP
  
            FOR linkedPlacex IN select * from placex where osm_type = upper(substring(relMember.member,1,1))::char(1) 
-             and osm_id = substring(relMember.member,2,10000)::bigint order by rank_search desc limit 1 LOOP
+             and osm_id = substring(relMember.member,2,10000)::bigint
+             and class = 'place' order by rank_search desc limit 1 LOOP
  
              -- For an admin centre we also want a name match - still not perfect, for example 'new york, new york'
              -- But that can be fixed by explicitly setting the label in the data
@@@ -2401,7 -2403,7 +2403,7 @@@ BEGI
        CASE WHEN class = 'place' and type = 'postcode' THEN hstore('name', postcode) ELSE name END as name,
        CASE WHEN extratags ? 'place' THEN 'place' ELSE class END as class,
        CASE WHEN extratags ? 'place' THEN extratags->'place' ELSE type END as type,
 -      admin_level, fromarea, isaddress,
 +      admin_level, fromarea, isaddress and linked_place_id is NULL as isaddress,
        CASE WHEN address_place_id = for_place_id AND rank_address = 0 THEN 100 WHEN rank_address = 11 THEN 5 ELSE rank_address END as rank_address,
        distance,country_code,postcode
        from place_addressline join placex on (address_place_id = placex.place_id) 
      IF searchpostcode IS NOT NULL and location.type = 'postcode' THEN
        location.isaddress := FALSE;
      END IF;
-     IF searchpostcode IS NULL and location.isaddress and location.type != 'postcode' and location.postcode IS NOT NULL THEN
+     IF searchpostcode IS NULL and location.isaddress and location.type != 'postcode' and location.postcode IS NOT NULL and location.postcode not similar to '%(,|;)%' THEN
        searchpostcode := location.postcode;
      END IF;
      IF location.rank_address = 4 AND location.isaddress THEN