]> git.openstreetmap.org Git - nominatim.git/commitdiff
Merge remote-tracking branch 'upstream/master'
authorSarah Hoffmann <lonvia@denofr.de>
Wed, 11 Feb 2015 21:34:18 +0000 (22:34 +0100)
committerSarah Hoffmann <lonvia@denofr.de>
Wed, 11 Feb 2015 21:34:18 +0000 (22:34 +0100)
1  2 
sql/functions.sql

diff --combined sql/functions.sql
index b4ecdad84c33c2146e079243c166f54c33c230d6,9aaab2566fd01ff5c97f5e1f7c3a68dd0c08960b..29e6544c4500014a8c9f5161dea5ee674b25cfde
@@@ -886,11 -886,6 +886,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;
@@@ -1252,6 -1247,7 +1252,7 @@@ DECLAR
    location_distance FLOAT;
    location_parent GEOMETRY;
    location_isaddress BOOLEAN;
+   location_keywords INTEGER[];
  
    tagpairid INTEGER;
  
@@@ -1798,10 -1794,26 +1799,26 @@@ BEGI
  
        IF location.rank_address != location_rank_search THEN
          location_rank_search := location.rank_address;
-         location_distance := location.distance * 1.5;
+         IF location.isguess THEN
+           location_distance := location.distance * 1.5;
+         ELSE
+           IF location.rank_address <= 12 THEN
+             -- for county and above, if we have an area consider that exact
+             -- (It would be nice to relax the constraint for places close to
+             --  the boundary but we'd need the exact geometry for that. Too
+             --  expensive.)
+             location_distance = 0;
+           ELSE
+             -- Below county level remain slightly fuzzy.
+             location_distance := location.distance * 0.5;
+           END IF;
+         END IF;
+       ELSE
+         CONTINUE WHEN location.keywords <@ location_keywords;
        END IF;
  
        IF location.distance < location_distance OR NOT location.isguess THEN
+         location_keywords := location.keywords;
  
          location_isaddress := NOT address_havelevel[location.rank_address];
          IF location_isaddress AND location.isguess AND location_parent IS NOT NULL THEN
@@@ -2025,11 -2037,6 +2042,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, '')