From: Sarah Hoffmann Date: Wed, 11 Feb 2015 21:34:18 +0000 (+0100) Subject: Merge remote-tracking branch 'upstream/master' X-Git-Tag: deploy~481 X-Git-Url: https://git.openstreetmap.org./nominatim.git/commitdiff_plain/a1a03a9b7965edf4f0dbbd6ac770dbe60190cbcb?hp=-c Merge remote-tracking branch 'upstream/master' --- a1a03a9b7965edf4f0dbbd6ac770dbe60190cbcb diff --combined sql/functions.sql index b4ecdad8,9aaab256..29e6544c --- a/sql/functions.sql +++ b/sql/functions.sql @@@ -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 @@@ -2220,12 -2227,6 +2237,12 @@@ 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, '')