]> git.openstreetmap.org Git - nominatim.git/commitdiff
Merge remote-tracking branch 'upstream/master'
authorSarah Hoffmann <lonvia@denofr.de>
Tue, 20 Nov 2018 19:26:56 +0000 (20:26 +0100)
committerSarah Hoffmann <lonvia@denofr.de>
Tue, 20 Nov 2018 19:26:56 +0000 (20:26 +0100)
1  2 
sql/functions.sql

diff --combined sql/functions.sql
index 33a5e6b9709647959b1abe45c988dd9388f45454,4a12921076e18a145f76dee652dd3349adebc4cd..f1f473b6460626806b5bc20feb3dee799983b2f3
@@@ -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)