]> git.openstreetmap.org Git - nominatim.git/commitdiff
invalidate rank >27 places around roads
authorSarah Hoffmann <lonvia@denofr.de>
Sun, 16 Dec 2012 10:54:46 +0000 (11:54 +0100)
committerSarah Hoffmann <lonvia@denofr.de>
Sun, 16 Dec 2012 10:56:29 +0000 (11:56 +0100)
Ensures that addresses are correctly reparented if a road is inserted
after the address itself was inserted.

sql/functions.sql

index aa2a8908a1f24a664681524d8094b4c5d0a570a5..dfb6463478d6ada2f9e2d9699b8bd378b1da8400 100644 (file)
@@ -1209,7 +1209,13 @@ BEGIN
     END IF;
     IF diameter > 0 THEN
 --      RAISE WARNING 'placex point insert: % % % % %',NEW.osm_type,NEW.osm_id,NEW.class,NEW.type,diameter;
-      update placex set indexed_status = 2 where indexed_status = 0 and rank_search > NEW.rank_search and ST_DWithin(placex.geometry, NEW.geometry, diameter) and (rank_search < 28 or name is not null);
+      IF NEW.rank_search >= 26 THEN
+        -- roads may cause reparenting for >27 rank places
+        update placex set indexed_status = 2 where indexed_status = 0 and rank_search > NEW.rank_search and ST_DWithin(placex.geometry, NEW.geometry, diameter);
+      ELSE
+        -- for all other places the search terms may change as well
+        update placex set indexed_status = 2 where indexed_status = 0 and rank_search > NEW.rank_search and ST_DWithin(placex.geometry, NEW.geometry, diameter) and (rank_search < 28 or name is not null);
+      END IF;
     END IF;
 
   END IF;