X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/de45bafc5455c3ccf4c8fd082abef9ee8dfe9d3d..bb18cc861caea017266761fcca2429d045a254b0:/sql/functions.sql diff --git a/sql/functions.sql b/sql/functions.sql index 48720628..4670a71f 100644 --- a/sql/functions.sql +++ b/sql/functions.sql @@ -347,7 +347,7 @@ BEGIN w := getorcreate_word_id(s); - IF NOT (ARRAY[w] <@ result) THEN + IF w IS NOT NULL AND NOT (ARRAY[w] <@ result) THEN result := result || w; END IF; @@ -415,7 +415,7 @@ BEGIN w := getorcreate_word_id(s); - IF NOT (ARRAY[w] <@ result) THEN + IF w IS NOT NULL AND NOT (ARRAY[w] <@ result) THEN result := result || w; END IF; @@ -938,10 +938,6 @@ BEGIN --DEBUG: RAISE WARNING '% %',NEW.osm_type,NEW.osm_id; -- just block these - IF NEW.class = 'highway' and NEW.type in ('turning_circle','traffic_signals','mini_roundabout','noexit','crossing') THEN --- RAISE WARNING 'bad highway %',NEW.osm_id; - RETURN null; - END IF; IF NEW.class in ('landuse','natural') and NEW.name is null THEN -- RAISE WARNING 'empty landuse %',NEW.osm_id; RETURN null; @@ -1127,7 +1123,11 @@ BEGIN return NULL; END IF; NEW.rank_search := NEW.admin_level * 2; - NEW.rank_address := NEW.rank_search; + IF NEW.type = 'administrative' THEN + NEW.rank_address := NEW.rank_search; + ELSE + NEW.rank_address := 0; + END IF; ELSEIF NEW.class = 'landuse' AND ST_GeometryType(NEW.geometry) in ('ST_Polygon','ST_MultiPolygon') THEN NEW.rank_search := 22; NEW.rank_address := NEW.rank_search; @@ -2044,9 +2044,6 @@ BEGIN END IF; -- Just block these - lots and pointless - IF NEW.class = 'highway' and NEW.type in ('turning_circle','traffic_signals','mini_roundabout','noexit','crossing') THEN - RETURN null; - END IF; IF NEW.class in ('landuse','natural') and NEW.name is null THEN RETURN null; END IF; @@ -2258,7 +2255,7 @@ BEGIN country_code = NEW.country_code, parent_place_id = null, extratags = NEW.extratags, - admin_level = NEW.admin_level, + admin_level = CASE WHEN NEW.admin_level > 15 THEN 15 ELSE NEW.admin_level END, indexed_status = 2, geometry = NEW.geometry where place_id = existingplacex.place_id;