X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/fe8566928e395dd76d5be0e9f4a8dea00156f787..c84e7e72f11825f9a0bf20fc05dc1d71093b92fb:/sql/functions/address_lookup.sql?ds=sidebyside

diff --git a/sql/functions/address_lookup.sql b/sql/functions/address_lookup.sql
index d1ed6990..b20cb364 100644
--- a/sql/functions/address_lookup.sql
+++ b/sql/functions/address_lookup.sql
@@ -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;
