]> git.openstreetmap.org Git - nominatim.git/commitdiff
Merge remote-tracking branch 'upstream/master'
authorSarah Hoffmann <lonvia@denofr.de>
Mon, 21 Jul 2014 20:53:45 +0000 (22:53 +0200)
committerSarah Hoffmann <lonvia@denofr.de>
Mon, 21 Jul 2014 20:53:45 +0000 (22:53 +0200)
1  2 
sql/functions.sql

diff --combined sql/functions.sql
index ac726cb331a66366a090073bcd87fa260cb5c8e5,c2359a3c931d119b356c0a719f70c0e7116515b2..4224977cffef4f56df9745b11d144aa82fe5702a
@@@ -936,11 -936,6 +936,11 @@@ DECLAR
  BEGIN
    --DEBUG: RAISE WARNING '% %',NEW.osm_type,NEW.osm_id;
  
 +  -- remove operator tag for most places, messes too much with search_name indexes
 +  IF NEW.class not in ('amenity', 'shop') THEN
 +    NEW.name := delete(NEW.name, 'operator');
 +  END IF;
 +
    -- just block these
    IF NEW.class in ('landuse','natural') and NEW.name is null THEN
  --    RAISE WARNING 'empty landuse %',NEW.osm_id;
@@@ -1380,9 -1375,12 +1380,12 @@@ BEGI
          FOR relation IN select * from planet_osm_rels r where r.id = NEW.osm_id and r.parts != array[]::bigint[]
          LOOP
              FOR i IN 1..array_upper(relation.members, 1) BY 2 LOOP
-                 IF relation.members[i+1] in ('', 'main_stream') AND substring(relation.members[i],1,1) = 'w' THEN
+                 IF relation.members[i+1] in ('', 'main_stream', 'side_stream') AND substring(relation.members[i],1,1) = 'w' THEN
                    --DEBUG: RAISE WARNING 'waterway parent %, child %/%', NEW.osm_id, i, relation.parts[i];
-                   FOR location IN SELECT * FROM placex WHERE osm_type = 'W' and osm_id = substring(relation.members[i],2,200)::bigint and class = NEW.class and type = NEW.type
+                   FOR location IN SELECT * FROM placex
+                     WHERE osm_type = 'W' and osm_id = substring(relation.members[i],2,200)::bigint
+                     and class = NEW.class and type = NEW.type
+                     and ( relation.members[i+1] != 'side_stream' or NEW.name->'name' = name->'name')
                    LOOP
                      UPDATE placex SET linked_place_id = NEW.place_id WHERE place_id = location.place_id;
                    END LOOP;
@@@ -2064,11 -2062,6 +2067,11 @@@ BEGI
      --DEBUG: RAISE WARNING '%', existingplacex;
    END IF;
  
 +  -- remove operator tag for most places, messes too much with search_name indexes
 +  IF NEW.class not in ('amenity', 'shop') THEN
 +    NEW.name := delete(NEW.name, 'operator');
 +  END IF;
 +
    -- Just block these - lots and pointless
    IF NEW.class in ('landuse','natural') and NEW.name is null THEN
      -- if the name tag was removed, older versions might still be lurking in the place table
  
    END IF;
  
 +  -- refuse to update multiplpoygons with too many objects, too much of a performance hit
 +  IF ST_NumGeometries(NEW.geometry) > 2000 THEN
 +    RAISE WARNING 'Dropping update of % % because of geometry complexity.', NEW.osm_type, NEW.osm_id;
 +    RETURN NULL;
 +  END IF;
 +
    IF coalesce(existing.name::text, '') != coalesce(NEW.name::text, '')
       OR coalesce(existing.extratags::text, '') != coalesce(NEW.extratags::text, '')
       OR coalesce(existing.housenumber, '') != coalesce(NEW.housenumber, '')