X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/c7472662a69eb6074a58917dbde71cf2b27e8d6e..1e76d668bd94f36f85149c4e35d52fa24a10c01f:/sql/functions/placex_triggers.sql?ds=sidebyside

diff --git a/sql/functions/placex_triggers.sql b/sql/functions/placex_triggers.sql
index 5e43b27a..6fd9e225 100644
--- a/sql/functions/placex_triggers.sql
+++ b/sql/functions/placex_triggers.sql
@@ -138,6 +138,7 @@ DECLARE
 BEGIN
   IF bnd.rank_search >= 26 or bnd.rank_address = 0
      or ST_GeometryType(bnd.geometry) NOT IN ('ST_Polygon','ST_MultiPolygon')
+     or bnd.type IN ('postcode', 'postal_code')
   THEN
     RETURN NULL;
   END IF;
@@ -813,11 +814,15 @@ BEGIN
 
       END IF;
 
-      IF NOT %REVERSE-ONLY% THEN
+      IF not %REVERSE-ONLY% AND (array_length(name_vector, 1) is not NULL
+         OR inherited_address is not NULL OR NEW.address is not NULL)
+      THEN
         SELECT * INTO name_vector, nameaddress_vector
-          FROM create_poi_search_terms(NEW.parent_place_id,
+          FROM create_poi_search_terms(NEW.place_id,
+                                       NEW.partition, NEW.parent_place_id,
                                        inherited_address || NEW.address,
-                                       NEW.housenumber, name_vector);
+                                       NEW.country_code, NEW.housenumber,
+                                       name_vector, NEW.centroid);
 
         IF array_length(name_vector, 1) is not NULL THEN
           INSERT INTO search_name (place_id, search_rank, address_rank,
