X-Git-Url: https://git.openstreetmap.org/nominatim.git/blobdiff_plain/f0af5c5643d6fb69859f00e55cb52e77c3c87476..31ba7e7cf04b5383c059fc962e067d5a6be18951:/sql/functions/aux_property.sql

diff --git a/sql/functions/aux_property.sql b/sql/functions/aux_property.sql
index b622f78b..6dd99eb2 100644
--- a/sql/functions/aux_property.sql
+++ b/sql/functions/aux_property.sql
@@ -12,7 +12,7 @@ DECLARE
   out_partition INTEGER;
   out_parent_place_id BIGINT;
   location RECORD;
-  address_street_word_id INTEGER;
+  address_street_word_ids INTEGER[];
   out_postcode TEXT;
 
 BEGIN
@@ -21,16 +21,15 @@ BEGIN
   out_partition := get_partition(in_countrycode);
   out_parent_place_id := null;
 
-  address_street_word_id := get_name_id(make_standard_name(in_street));
-  IF address_street_word_id IS NOT NULL THEN
-    FOR location IN SELECT * from getNearestNamedRoadFeature(out_partition, place_centroid, address_street_word_id) LOOP
-      out_parent_place_id := location.place_id;
-    END LOOP;
+  address_street_word_ids := word_ids_from_name(in_street);
+  IF address_street_word_ids IS NOT NULL THEN
+    out_parent_place_id := getNearestNamedRoadPlaceId(out_partition, place_centroid,
+                                                      address_street_word_ids);
   END IF;
 
   IF out_parent_place_id IS NULL THEN
-    FOR location IN SELECT place_id FROM getNearestRoadFeature(out_partition, place_centroid) LOOP
-      out_parent_place_id := location.place_id;
+    SELECT getNearestRoadPlaceId(out_partition, place_centroid)
+      INTO out_parent_place_id;
     END LOOP;
   END IF;
 
