]> git.openstreetmap.org Git - nominatim.git/blobdiff - sql/functions.sql
Merge branch 'master' of http://github.com/twain47/Nominatim
[nominatim.git] / sql / functions.sql
index 548362ad21230775dc9d0bd889cfa416d39649ec..b1280caca85f3d38a7fc95f2f6f3f0e1f6450029 100644 (file)
@@ -1639,6 +1639,8 @@ BEGIN
     location_rank_search := 0;
     location_distance := 0;
     location_parent := NULL;
+    -- added ourself as address already
+    address_havelevel[NEW.rank_address] := true;
     -- RAISE WARNING '  getNearFeatures(%,''%'',%,''%'')',NEW.partition, place_centroid, search_maxrank, isin_tokens;
     FOR location IN SELECT * from getNearFeatures(NEW.partition, place_centroid, search_maxrank, isin_tokens) LOOP
 
@@ -2178,7 +2180,7 @@ BEGIN
 
   FOR location IN select * from get_addressdata(for_place_id) where isaddress order by rank_address desc LOOP
     currresult := trim(get_name_by_language(location.name, languagepref));
-    IF currresult != prevresult AND currresult IS NOT NULL THEN
+    IF currresult != prevresult AND currresult IS NOT NULL AND result[(100 - location.rank_address)] IS NULL THEN
       result[(100 - location.rank_address)] := trim(get_name_by_language(location.name, languagepref));
       prevresult := currresult;
     END IF;