X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/5c2982adcec6746ed31ac53d5e7efc8a797888e8..3ce0917874b55d8013d8bb37113e42dfb0c8b452:/sql/functions.sql

diff --git a/sql/functions.sql b/sql/functions.sql
index c3590c1e..afa687be 100644
--- a/sql/functions.sql
+++ b/sql/functions.sql
@@ -1642,7 +1642,7 @@ BEGIN
         -- Performance, it would be more acurate to do all the rest of the import process but it takes too long
         -- Just be happy with inheriting from parent road only
 
-        IF NEW.rank_search <= 25 THEN
+        IF NEW.rank_search <= 25 and NEW.rank_address > 0 THEN
           result := add_location(NEW.place_id, NEW.calculated_country_code, NEW.partition, name_vector, NEW.rank_search, NEW.rank_address, NEW.geometry);
         END IF;
 
@@ -1734,7 +1734,7 @@ BEGIN
     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
+    IF NEW.osm_type in ('W','R') AND NEW.rank_search < 26 AND NEW.rank_address > 0 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
@@ -1978,7 +1978,7 @@ BEGIN
     -- if we have a name add this to the name search table
     IF NEW.name IS NOT NULL THEN
 
-      IF NEW.rank_search <= 25 THEN
+      IF NEW.rank_search <= 25 and NEW.rank_address > 0 THEN
         result := add_location(NEW.place_id, NEW.calculated_country_code, NEW.partition, name_vector, NEW.rank_search, NEW.rank_address, NEW.geometry);
       END IF;
 
