]> git.openstreetmap.org Git - nominatim.git/blobdiff - sql/functions.sql
remove 'closed for indexing' feature
[nominatim.git] / sql / functions.sql
index e060a26598033e9d93d35111acea4c4a5db361ce..5b068dfe03f5ed7557939c2f99054d5e98b74160 100644 (file)
@@ -1,3 +1,15 @@
+-- Splits the line at the given point and returns the two parts
+-- in a multilinestring.
+CREATE OR REPLACE FUNCTION split_line_on_node(line GEOMETRY, point GEOMETRY)
+RETURNS GEOMETRY
+  AS $$
+BEGIN
+  RETURN ST_Split(ST_Snap(line, point, 0.0005), point);
+END;
+$$
+LANGUAGE plpgsql;
+
+
 CREATE OR REPLACE FUNCTION geometry_sector(partition INTEGER, place geometry) RETURNS INTEGER
   AS $$
 DECLARE
@@ -1161,7 +1173,8 @@ BEGIN
     DELETE FROM place_addressline WHERE place_id = NEW.place_id;
     result := deleteRoad(NEW.partition, NEW.place_id);
     result := deleteLocationArea(NEW.partition, NEW.place_id, NEW.rank_search);
-    UPDATE placex set linked_place_id = null where linked_place_id = NEW.place_id;
+    UPDATE placex set linked_place_id = null, indexed_status = 2
+           where linked_place_id = NEW.place_id;
 
     IF NEW.linked_place_id is not null THEN
       RETURN NEW;
@@ -2196,7 +2209,7 @@ BEGIN
   result := '{}';
   prevresult := '';
 
-  FOR location IN select * from get_addressdata(for_place_id,housenumber) where isaddress order by rank_address desc LOOP
+  FOR location IN select * from get_addressdata(for_place_id, housenumber) where isaddress order by rank_address desc LOOP
     currresult := trim(get_name_by_language(location.name, languagepref));
     IF currresult != prevresult AND currresult IS NOT NULL AND result[(100 - location.rank_address)] IS NULL THEN
       result[(100 - location.rank_address)] := trim(get_name_by_language(location.name, languagepref));