]> git.openstreetmap.org Git - nominatim.git/commitdiff
make sure first of each address rank is used
authorSarah Hoffmann <lonvia@denofr.de>
Sun, 19 Aug 2012 21:08:51 +0000 (23:08 +0200)
committerSarah Hoffmann <lonvia@denofr.de>
Sun, 19 Aug 2012 21:08:51 +0000 (23:08 +0200)
get_addressdata should not really return duplicates but if there are
the first result will be the best one, so make sure that one is used

sql/functions.sql

index 548362ad21230775dc9d0bd889cfa416d39649ec..382cb003425816e5e1e75ea43859b507fe1c3a7b 100644 (file)
@@ -2178,7 +2178,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;