]> git.openstreetmap.org Git - nominatim.git/blobdiff - sql/functions/address_lookup.sql
Merge remote-tracking branch 'upstream/master'
[nominatim.git] / sql / functions / address_lookup.sql
index 196fb434868f69aacf87bdd7b895f80e11c458db..53bc1ae3aa34563124a578ddddcff80cf8354fb6 100644 (file)
@@ -101,6 +101,7 @@ DECLARE
   postcode_isexact BOOL;
   searchclass TEXT;
   searchtype TEXT;
+  search_unlisted_place TEXT;
   countryname HSTORE;
 BEGIN
   -- The place ein question might not have a direct entry in place_addressline.
@@ -155,11 +156,13 @@ BEGIN
   IF for_place_id IS NULL THEN
     SELECT parent_place_id, country_code, housenumber, rank_search,
            postcode, address is not null and address ? 'postcode',
-           name, class, type
+           name, class, type,
+           address -> '_unlisted_place' as unlisted_place
       FROM placex
       WHERE place_id = in_place_id and rank_search > 27
       INTO for_place_id, searchcountrycode, searchhousenumber, searchrankaddress,
-           searchpostcode, postcode_isexact, searchhousename, searchclass, searchtype;
+           searchpostcode, postcode_isexact, searchhousename, searchclass,
+           searchtype, search_unlisted_place;
   END IF;
 
   -- If for_place_id is still NULL at this point then the object has its own
@@ -279,6 +282,11 @@ BEGIN
     RETURN NEXT location;
   END IF;
 
+  IF search_unlisted_place is not null THEN
+    RETURN NEXT ROW(null, null, null, hstore('name', search_unlisted_place),
+                    'place', 'locality', null, null, true, true, 26, 0)::addressline;
+  END IF;
+
   IF searchpostcode IS NOT NULL THEN
     location := ROW(null, null, null, hstore('ref', searchpostcode), 'place',
                     'postcode', null, null, false, true, 5, 0)::addressline;