]> git.openstreetmap.org Git - nominatim.git/commitdiff
Merge remote-tracking branch 'upstream/master'
authorSarah Hoffmann <lonvia@denofr.de>
Sun, 9 Feb 2014 07:33:20 +0000 (08:33 +0100)
committerSarah Hoffmann <lonvia@denofr.de>
Sun, 9 Feb 2014 07:33:20 +0000 (08:33 +0100)
1  2 
sql/functions.sql

diff --combined sql/functions.sql
index 6c9e092e1f3afac9d782dcc4b5f5dc526ff4b157,62847e39a1b79dc1f8399e8ce8d97207ad7dba95..839d086c5b78b0b577d4ed7bd9e3c243a5beec0a
@@@ -937,11 -937,6 +937,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;
@@@ -1362,26 -1357,13 +1362,26 @@@ BEGI
      NEW.centroid := null;
  
      -- reclaculate country and partition
 -    IF NEW.rank_search >= 4 THEN
 -      --NEW.calculated_country_code := lower(get_country_code(NEW.geometry, NEW.country_code));
 -      NEW.calculated_country_code := lower(get_country_code(place_centroid));
 +    IF NEW.rank_search = 4 THEN
 +      -- for countries, believe the mapped country code,
 +      -- so that we remain in the right partition if the boundaries
 +      -- suddenly expand.
 +      NEW.partition := get_partition(place_centroid, lower(NEW.country_code));
 +      IF NEW.partition = 0 THEN
 +        NEW.calculated_country_code := lower(get_country_code(place_centroid));
 +        NEW.partition := get_partition(place_centroid, NEW.calculated_country_code);
 +      ELSE
 +        NEW.calculated_country_code := lower(NEW.country_code);
 +      END IF;
      ELSE
 -      NEW.calculated_country_code := NULL;
 +      IF NEW.rank_search > 4 THEN
 +        --NEW.calculated_country_code := lower(get_country_code(NEW.geometry, NEW.country_code));
 +        NEW.calculated_country_code := lower(get_country_code(place_centroid));
 +      ELSE
 +        NEW.calculated_country_code := NULL;
 +      END IF;
 +      NEW.partition := get_partition(place_centroid, NEW.calculated_country_code);
      END IF;
 -    NEW.partition := get_partition(place_centroid, NEW.calculated_country_code);
      NEW.geometry_sector := geometry_sector(NEW.partition, place_centroid);
  
      -- Adding ourselves to the list simplifies address calculations later
@@@ -2061,13 -2043,10 +2061,15 @@@ 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
+     DELETE FROM place where osm_type = NEW.osm_type and osm_id = NEW.osm_id and class = NEW.class and type = NEW.type;
      RETURN null;
    END IF;
  
  
    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, '')