]> git.openstreetmap.org Git - nominatim.git/commitdiff
use place type of for result object in address parts
authorSarah Hoffmann <lonvia@denofr.de>
Thu, 17 Sep 2020 16:17:01 +0000 (18:17 +0200)
committerSarah Hoffmann <lonvia@denofr.de>
Thu, 17 Sep 2020 16:17:01 +0000 (18:17 +0200)
Boundaries shound derive the address part type from the
linked place if possible. This was already implemented
for the address objects but not for the address information
from the address itself.

Fixes #1949.

sql/functions/address_lookup.sql
test/bdd/api/search/queries.feature

index 42c015bfd28d3d1fedb77e907740cab9ccf7d867..d1ed69902eb61f2a30a4e0b1e279e6f9198c7b9e 100644 (file)
@@ -180,6 +180,7 @@ BEGIN
   -- Return the record for the base entry.
   FOR location IN
     SELECT placex.place_id, osm_type, osm_id, name,
   -- Return the record for the base entry.
   FOR location IN
     SELECT placex.place_id, osm_type, osm_id, name,
+           coalesce(extratags->'linked_place', extratags->'place') as place_type,
            class, type, admin_level,
            type not in ('postcode', 'postal_code') as isaddress,
            CASE WHEN rank_address = 0 THEN 100
            class, type, admin_level,
            type not in ('postcode', 'postal_code') as isaddress,
            CASE WHEN rank_address = 0 THEN 100
@@ -198,7 +199,8 @@ BEGIN
       searchcountrycode := NULL;
     END IF;
     countrylocation := ROW(location.place_id, location.osm_type, location.osm_id,
       searchcountrycode := NULL;
     END IF;
     countrylocation := ROW(location.place_id, location.osm_type, location.osm_id,
-                           location.name, location.class, location.type, NULL,
+                           location.name, location.class, location.type,
+                           location.place_type,
                            location.admin_level, true, location.isaddress,
                            location.rank_address, location.distance)::addressline;
     RETURN NEXT countrylocation;
                            location.admin_level, true, location.isaddress,
                            location.rank_address, location.distance)::addressline;
     RETURN NEXT countrylocation;
index b521c1714f89a1afc8ef058f29fc851c71ef91b9..e5040f1e247b79ab8bb2808df568ce9dea8436b7 100644 (file)
@@ -182,3 +182,11 @@ Feature: Search queries
         Then results contain
           | class   | type |
           | highway | residential |
         Then results contain
           | class   | type |
           | highway | residential |
+
+
+    # github #1949
+    Scenario: Addressdetails always return the place type
+       When sending json search query "Rotherbaum" with address
+       Then result addresses contain
+         | ID | suburb |
+         | 0  | Rotherbaum |