From: Sarah Hoffmann Date: Tue, 20 Nov 2018 19:26:56 +0000 (+0100) Subject: Merge remote-tracking branch 'upstream/master' X-Git-Tag: deploy~305 X-Git-Url: https://git.openstreetmap.org./nominatim.git/commitdiff_plain/d1041979ecfc352399fa8828b771eb559cb57351?hp=-c Merge remote-tracking branch 'upstream/master' --- d1041979ecfc352399fa8828b771eb559cb57351 diff --combined sql/functions.sql index 33a5e6b9,4a129210..f1f473b6 --- a/sql/functions.sql +++ b/sql/functions.sql @@@ -869,20 -869,24 +869,24 @@@ BEGI END IF; ELSEIF NEW.class = 'place' THEN - IF NEW.type in ('continent') THEN - NEW.rank_search := 2; - NEW.rank_address := NEW.rank_search; - NEW.country_code := NULL; - ELSEIF NEW.type in ('sea') THEN + IF NEW.type in ('continent', 'sea') THEN NEW.rank_search := 2; NEW.rank_address := 0; NEW.country_code := NULL; ELSEIF NEW.type in ('country') THEN NEW.rank_search := 4; - NEW.rank_address := NEW.rank_search; + IF ST_GeometryType(NEW.geometry) IN ('ST_Polygon','ST_MultiPolygon') THEN + NEW.rank_address := NEW.rank_search; + ELSE + NEW.rank_address := 0; + END IF; ELSEIF NEW.type in ('state') THEN NEW.rank_search := 8; - NEW.rank_address := NEW.rank_search; + IF ST_GeometryType(NEW.geometry) IN ('ST_Polygon','ST_MultiPolygon') THEN + NEW.rank_address := NEW.rank_search; + ELSE + NEW.rank_address := 0; + END IF; ELSEIF NEW.type in ('region') THEN NEW.rank_search := 18; -- dropped from previous value of 10 NEW.rank_address := 0; -- So badly miss-used that better to just drop it! @@@ -2461,7 -2465,7 +2465,7 @@@ BEGI select placex.place_id, osm_type, osm_id, name, CASE WHEN extratags ? 'place' THEN 'place' ELSE class END as class, CASE WHEN extratags ? 'place' THEN extratags->'place' ELSE type END as type, - admin_level, fromarea, isaddress, + admin_level, fromarea, isaddress and linked_place_id is NULL as isaddress, CASE WHEN address_place_id = for_place_id AND rank_address = 0 THEN 100 WHEN rank_address = 11 THEN 5 ELSE rank_address END as rank_address, distance,country_code,postcode from place_addressline join placex on (address_place_id = placex.place_id)