mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-26 11:08:13 +00:00
do not attempt to delete old data for newly created placex entries
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
--
|
--
|
||||||
-- This file is part of Nominatim. (https://nominatim.org)
|
-- This file is part of Nominatim. (https://nominatim.org)
|
||||||
--
|
--
|
||||||
-- Copyright (C) 2022 by the Nominatim developer community.
|
-- Copyright (C) 2026 by the Nominatim developer community.
|
||||||
-- For a full list of authors see the git log.
|
-- For a full list of authors see the git log.
|
||||||
|
|
||||||
DROP TYPE IF EXISTS nearfeaturecentr CASCADE;
|
DROP TYPE IF EXISTS nearfeaturecentr CASCADE;
|
||||||
@@ -214,7 +214,6 @@ DECLARE
|
|||||||
BEGIN
|
BEGIN
|
||||||
{% for partition in db.partitions %}
|
{% for partition in db.partitions %}
|
||||||
IF in_partition = {{ partition }} THEN
|
IF in_partition = {{ partition }} THEN
|
||||||
DELETE FROM search_name_{{ partition }} values WHERE place_id = in_place_id;
|
|
||||||
IF in_rank_address > 0 THEN
|
IF in_rank_address > 0 THEN
|
||||||
INSERT INTO search_name_{{ partition }} (place_id, address_rank, name_vector, centroid)
|
INSERT INTO search_name_{{ partition }} (place_id, address_rank, name_vector, centroid)
|
||||||
values (in_place_id, in_rank_address, in_name_vector, in_geometry);
|
values (in_place_id, in_rank_address, in_name_vector, in_geometry);
|
||||||
@@ -253,7 +252,6 @@ BEGIN
|
|||||||
|
|
||||||
{% for partition in db.partitions %}
|
{% for partition in db.partitions %}
|
||||||
IF in_partition = {{ partition }} THEN
|
IF in_partition = {{ partition }} THEN
|
||||||
DELETE FROM location_road_{{ partition }} where place_id = in_place_id;
|
|
||||||
INSERT INTO location_road_{{ partition }} (partition, place_id, country_code, geometry)
|
INSERT INTO location_road_{{ partition }} (partition, place_id, country_code, geometry)
|
||||||
values (in_partition, in_place_id, in_country_code, in_geometry);
|
values (in_partition, in_place_id, in_country_code, in_geometry);
|
||||||
RETURN TRUE;
|
RETURN TRUE;
|
||||||
|
|||||||
@@ -840,13 +840,15 @@ BEGIN
|
|||||||
|
|
||||||
NEW.indexed_date = now();
|
NEW.indexed_date = now();
|
||||||
|
|
||||||
{% if 'search_name' in db.tables %}
|
IF OLD.indexed_status > 1 THEN
|
||||||
DELETE from search_name WHERE place_id = NEW.place_id;
|
{% if 'search_name' in db.tables %}
|
||||||
{% endif %}
|
DELETE from search_name WHERE place_id = NEW.place_id;
|
||||||
result := deleteSearchName(NEW.partition, NEW.place_id);
|
{% endif %}
|
||||||
DELETE FROM place_addressline WHERE place_id = NEW.place_id;
|
result := deleteSearchName(NEW.partition, NEW.place_id);
|
||||||
result := deleteRoad(NEW.partition, NEW.place_id);
|
DELETE FROM place_addressline WHERE place_id = NEW.place_id;
|
||||||
result := deleteLocationArea(NEW.partition, NEW.place_id, NEW.rank_search);
|
result := deleteRoad(NEW.partition, NEW.place_id);
|
||||||
|
result := deleteLocationArea(NEW.partition, NEW.place_id, NEW.rank_search);
|
||||||
|
END IF;
|
||||||
|
|
||||||
NEW.extratags := NEW.extratags - 'linked_place'::TEXT;
|
NEW.extratags := NEW.extratags - 'linked_place'::TEXT;
|
||||||
IF NEW.extratags = ''::hstore THEN
|
IF NEW.extratags = ''::hstore THEN
|
||||||
@@ -859,12 +861,13 @@ BEGIN
|
|||||||
NEW.linked_place_id := OLD.linked_place_id;
|
NEW.linked_place_id := OLD.linked_place_id;
|
||||||
|
|
||||||
-- Remove linkage, if we have computed a different new linkee.
|
-- Remove linkage, if we have computed a different new linkee.
|
||||||
UPDATE placex
|
IF OLD.indexed_status > 1 THEN
|
||||||
SET linked_place_id = null,
|
UPDATE placex
|
||||||
indexed_status = CASE WHEN indexed_status = 0 THEN 2 ELSE indexed_status END
|
SET linked_place_id = null,
|
||||||
WHERE linked_place_id = NEW.place_id
|
indexed_status = CASE WHEN indexed_status = 0 THEN 2 ELSE indexed_status END
|
||||||
and (linked_place is null or place_id != linked_place);
|
WHERE linked_place_id = NEW.place_id
|
||||||
-- update not necessary for osmline, cause linked_place_id does not exist
|
and (linked_place is null or place_id != linked_place);
|
||||||
|
END IF;
|
||||||
|
|
||||||
-- Compute a preliminary centroid.
|
-- Compute a preliminary centroid.
|
||||||
NEW.centroid := get_center_point(NEW.geometry);
|
NEW.centroid := get_center_point(NEW.geometry);
|
||||||
@@ -1034,7 +1037,9 @@ BEGIN
|
|||||||
LOOP
|
LOOP
|
||||||
UPDATE placex SET linked_place_id = NEW.place_id WHERE place_id = linked_node_id;
|
UPDATE placex SET linked_place_id = NEW.place_id WHERE place_id = linked_node_id;
|
||||||
{% if 'search_name' in db.tables %}
|
{% if 'search_name' in db.tables %}
|
||||||
DELETE FROM search_name WHERE place_id = linked_node_id;
|
IF OLD.indexed_status > 1 THEN
|
||||||
|
DELETE FROM search_name WHERE place_id = linked_node_id;
|
||||||
|
END IF;
|
||||||
{% endif %}
|
{% endif %}
|
||||||
END LOOP;
|
END LOOP;
|
||||||
END IF;
|
END IF;
|
||||||
@@ -1183,11 +1188,6 @@ BEGIN
|
|||||||
-- reset the address rank if necessary.
|
-- reset the address rank if necessary.
|
||||||
UPDATE placex set linked_place_id = NEW.place_id, indexed_status = 2
|
UPDATE placex set linked_place_id = NEW.place_id, indexed_status = 2
|
||||||
WHERE place_id = location.place_id;
|
WHERE place_id = location.place_id;
|
||||||
-- ensure that those places are not found anymore
|
|
||||||
{% if 'search_name' in db.tables %}
|
|
||||||
DELETE FROM search_name WHERE place_id = location.place_id;
|
|
||||||
{% endif %}
|
|
||||||
PERFORM deleteLocationArea(NEW.partition, location.place_id, NEW.rank_search);
|
|
||||||
|
|
||||||
SELECT wikipedia, importance
|
SELECT wikipedia, importance
|
||||||
FROM compute_importance(location.extratags, NEW.country_code,
|
FROM compute_importance(location.extratags, NEW.country_code,
|
||||||
|
|||||||
@@ -368,8 +368,6 @@ CREATE OR REPLACE FUNCTION add_location(place_id BIGINT, country_code varchar(2)
|
|||||||
DECLARE
|
DECLARE
|
||||||
postcode TEXT;
|
postcode TEXT;
|
||||||
BEGIN
|
BEGIN
|
||||||
PERFORM deleteLocationArea(partition, place_id, rank_search);
|
|
||||||
|
|
||||||
-- add postcode only if it contains a single entry, i.e. ignore postcode lists
|
-- add postcode only if it contains a single entry, i.e. ignore postcode lists
|
||||||
postcode := NULL;
|
postcode := NULL;
|
||||||
IF in_postcode is not null AND in_postcode not similar to '%(,|;)%' THEN
|
IF in_postcode is not null AND in_postcode not similar to '%(,|;)%' THEN
|
||||||
|
|||||||
Reference in New Issue
Block a user