X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/27ea1bb42db0356a81eb9fadb5515f9abf2bb130..89669d80b5c0c4c0068f8710191c44bc9da270a6:/sql/functions.sql?ds=sidebyside

diff --git a/sql/functions.sql b/sql/functions.sql
index d254e33e..ac64defc 100644
--- a/sql/functions.sql
+++ b/sql/functions.sql
@@ -1689,6 +1689,11 @@ BEGIN
         END IF;
       END IF;
 
+    END IF;
+
+    -- Name searches can be done for ways as well as relations
+    IF NEW.osm_type in ('W','R') AND NEW.rank_search < 26 THEN
+
       -- not found one yet? how about doing a name search
       IF NEW.centroid IS NULL AND (NEW.name->'name') is not null and make_standard_name(NEW.name->'name') != '' THEN
 
@@ -1845,19 +1850,21 @@ BEGIN
         INSERT INTO place_addressline VALUES (NEW.place_id, location.place_id, true, location_isaddress, location.distance, location.rank_address);
 
         IF location_isaddress THEN
-            address_havelevel[location.rank_address] := true;
-            IF NOT location.isguess THEN
-                SELECT geometry FROM placex WHERE place_id = location.place_id INTO location_parent;
-            END IF;
-        END IF;
 
---RAISE WARNING '  Terms: (%) %',location, nameaddress_vector;
+          address_havelevel[location.rank_address] := true;
+          IF NOT location.isguess THEN
+            SELECT geometry FROM placex WHERE place_id = location.place_id INTO location_parent;
+          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;
 
-        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;
 
+--RAISE WARNING '  Terms: (%) %',location, nameaddress_vector;
+
       END IF;
 
     END LOOP;
