mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-03-11 21:34:06 +00:00
delete outdated entries from location_area_country
This commit is contained in:
@@ -637,7 +637,7 @@ BEGIN
|
|||||||
|
|
||||||
-- RAISE WARNING 'Adding location with rank > 25 (% rank %)', place_id, rank_search;
|
-- RAISE WARNING 'Adding location with rank > 25 (% rank %)', place_id, rank_search;
|
||||||
|
|
||||||
x := deleteLocationArea(partition, place_id);
|
x := deleteLocationArea(partition, place_id, rank_search);
|
||||||
|
|
||||||
isarea := false;
|
isarea := false;
|
||||||
IF (ST_GeometryType(geometry) in ('ST_Polygon','ST_MultiPolygon') AND ST_IsValid(geometry)) THEN
|
IF (ST_GeometryType(geometry) in ('ST_Polygon','ST_MultiPolygon') AND ST_IsValid(geometry)) THEN
|
||||||
@@ -704,7 +704,7 @@ CREATE OR REPLACE FUNCTION update_location(
|
|||||||
DECLARE
|
DECLARE
|
||||||
b BOOLEAN;
|
b BOOLEAN;
|
||||||
BEGIN
|
BEGIN
|
||||||
b := deleteLocationArea(partition, place_id);
|
b := deleteLocationArea(partition, place_id, rank_search);
|
||||||
-- result := add_location(NEW.place_id, NEW.country_code, NEW.partition, name_vector, NEW.rank_search, NEW.rank_address, NEW.geometry);
|
-- result := add_location(NEW.place_id, NEW.country_code, NEW.partition, name_vector, NEW.rank_search, NEW.rank_address, NEW.geometry);
|
||||||
RETURN add_location(place_id, place_country_code, name, rank_search, rank_address, geometry);
|
RETURN add_location(place_id, place_country_code, name, rank_search, rank_address, geometry);
|
||||||
END;
|
END;
|
||||||
@@ -1323,7 +1323,7 @@ BEGIN
|
|||||||
DELETE FROM place_addressline WHERE place_id = NEW.place_id;
|
DELETE FROM place_addressline WHERE place_id = NEW.place_id;
|
||||||
DELETE FROM place_boundingbox where place_id = NEW.place_id;
|
DELETE FROM place_boundingbox where place_id = NEW.place_id;
|
||||||
result := deleteRoad(NEW.partition, NEW.place_id);
|
result := deleteRoad(NEW.partition, NEW.place_id);
|
||||||
result := deleteLocationArea(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 where linked_place_id = NEW.place_id;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
@@ -1884,7 +1884,7 @@ BEGIN
|
|||||||
--DEBUG: RAISE WARNING 'placex_delete:08 % %',OLD.osm_type,OLD.osm_id;
|
--DEBUG: RAISE WARNING 'placex_delete:08 % %',OLD.osm_type,OLD.osm_id;
|
||||||
|
|
||||||
IF OLD.rank_address < 26 THEN
|
IF OLD.rank_address < 26 THEN
|
||||||
b := deleteLocationArea(OLD.partition, OLD.place_id);
|
b := deleteLocationArea(OLD.partition, OLD.place_id, OLD.rank_search);
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
--DEBUG: RAISE WARNING 'placex_delete:09 % %',OLD.osm_type,OLD.osm_id;
|
--DEBUG: RAISE WARNING 'placex_delete:09 % %',OLD.osm_type,OLD.osm_id;
|
||||||
|
|||||||
@@ -31,10 +31,15 @@ END
|
|||||||
$$
|
$$
|
||||||
LANGUAGE plpgsql;
|
LANGUAGE plpgsql;
|
||||||
|
|
||||||
create or replace function deleteLocationArea(in_partition INTEGER, in_place_id BIGINT) RETURNS BOOLEAN AS $$
|
create or replace function deleteLocationArea(in_partition INTEGER, in_place_id BIGINT, in_rank_search INTEGER) RETURNS BOOLEAN AS $$
|
||||||
DECLARE
|
DECLARE
|
||||||
BEGIN
|
BEGIN
|
||||||
|
|
||||||
|
IF in_rank_search <= 4 THEN
|
||||||
|
DELETE from location_area_country WHERE place_id = in_place_id;
|
||||||
|
RETURN TRUE;
|
||||||
|
END IF;
|
||||||
|
|
||||||
-- start
|
-- start
|
||||||
IF in_partition = -partition- THEN
|
IF in_partition = -partition- THEN
|
||||||
DELETE from location_area_large_-partition- WHERE place_id = in_place_id;
|
DELETE from location_area_large_-partition- WHERE place_id = in_place_id;
|
||||||
|
|||||||
Reference in New Issue
Block a user