From: Sarah Hoffmann Date: Sat, 29 Sep 2012 16:02:32 +0000 (+0200) Subject: skip is_in items already in address vector X-Git-Tag: v2.0.0~17 X-Git-Url: https://git.openstreetmap.org./nominatim.git/commitdiff_plain/199308ca5e7719c8adf963e96a8e628334b2a6ab?hp=33375150521138f2bc8b55a14f25180910e703ff skip is_in items already in address vector --- diff --git a/sql/functions.sql b/sql/functions.sql index 236f5b9c..2ba1b6fa 100644 --- a/sql/functions.sql +++ b/sql/functions.sql @@ -1699,21 +1699,24 @@ BEGIN IF array_upper(isin_tokens, 1) IS NOT NULL THEN FOR i IN 1..array_upper(isin_tokens, 1) LOOP --RAISE WARNING ' getNearestNamedFeature: % % % %',NEW.partition, place_centroid, search_maxrank, isin_tokens[i]; + IF NOT ARRAY[isin_tokens[i]] <@ nameaddress_vector THEN - FOR location IN SELECT * from getNearestNamedFeature(NEW.partition, place_centroid, search_maxrank, isin_tokens[i]) LOOP + FOR location IN SELECT * from getNearestNamedFeature(NEW.partition, place_centroid, search_maxrank, isin_tokens[i]) LOOP ---RAISE WARNING ' ISIN: %',location; + --RAISE WARNING ' ISIN: %',location; - nameaddress_vector := array_merge(nameaddress_vector, location.keywords::integer[]); - INSERT INTO place_addressline VALUES (NEW.place_id, location.place_id, false, NOT address_havelevel[location.rank_address], location.distance, location.rank_address); - address_havelevel[location.rank_address] := true; + nameaddress_vector := array_merge(nameaddress_vector, location.keywords::integer[]); + INSERT INTO place_addressline VALUES (NEW.place_id, location.place_id, false, NOT address_havelevel[location.rank_address], location.distance, location.rank_address); + address_havelevel[location.rank_address] := true; - IF location.rank_address > parent_place_id_rank THEN - NEW.parent_place_id = location.place_id; - parent_place_id_rank = location.rank_address; - END IF; + IF location.rank_address > parent_place_id_rank THEN + NEW.parent_place_id = location.place_id; + parent_place_id_rank = location.rank_address; + END IF; - END LOOP; + END LOOP; + + END IF; END LOOP; END IF;