mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-03-11 13:24:07 +00:00
suppress recursive updates for places that cannot appear in addresses
This commit is contained in:
@@ -1150,7 +1150,7 @@ BEGIN
|
|||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
-- a country code make no sense below rank 4 (country)
|
-- a country code make no sense below rank 4 (country)
|
||||||
IF NEW.rank_address < 4 THEN
|
IF NEW.rank_search < 4 THEN
|
||||||
NEW.calculated_country_code := NULL;
|
NEW.calculated_country_code := NULL;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
@@ -1163,53 +1163,54 @@ BEGIN
|
|||||||
|
|
||||||
RETURN NEW; -- @DIFFUPDATES@ The following is not needed until doing diff updates, and slows the main index process down
|
RETURN NEW; -- @DIFFUPDATES@ The following is not needed until doing diff updates, and slows the main index process down
|
||||||
|
|
||||||
IF (ST_GeometryType(NEW.geometry) in ('ST_Polygon','ST_MultiPolygon') AND ST_IsValid(NEW.geometry)) THEN
|
IF NEW.rank_address > 0 THEN
|
||||||
-- Performance: We just can't handle re-indexing for country level changes
|
IF (ST_GeometryType(NEW.geometry) in ('ST_Polygon','ST_MultiPolygon') AND ST_IsValid(NEW.geometry)) THEN
|
||||||
IF st_area(NEW.geometry) < 1 THEN
|
-- Performance: We just can't handle re-indexing for country level changes
|
||||||
-- mark items within the geometry for re-indexing
|
IF st_area(NEW.geometry) < 1 THEN
|
||||||
-- RAISE WARNING 'placex poly insert: % % % %',NEW.osm_type,NEW.osm_id,NEW.class,NEW.type;
|
-- mark items within the geometry for re-indexing
|
||||||
|
-- RAISE WARNING 'placex poly insert: % % % %',NEW.osm_type,NEW.osm_id,NEW.class,NEW.type;
|
||||||
|
|
||||||
-- work around bug in postgis, this may have been fixed in 2.0.0 (see http://trac.osgeo.org/postgis/ticket/547)
|
-- work around bug in postgis, this may have been fixed in 2.0.0 (see http://trac.osgeo.org/postgis/ticket/547)
|
||||||
update placex set indexed_status = 2 where (st_covers(NEW.geometry, placex.geometry) OR ST_Intersects(NEW.geometry, placex.geometry))
|
update placex set indexed_status = 2 where (st_covers(NEW.geometry, placex.geometry) OR ST_Intersects(NEW.geometry, placex.geometry))
|
||||||
AND rank_search > NEW.rank_search and indexed_status = 0 and ST_geometrytype(placex.geometry) = 'ST_Point' and (rank_search < 28 or name is not null or (NEW.rank_search >= 16 and addr_place is not null));
|
AND rank_search > NEW.rank_search and indexed_status = 0 and ST_geometrytype(placex.geometry) = 'ST_Point' and (rank_search < 28 or name is not null or (NEW.rank_search >= 16 and addr_place is not null));
|
||||||
update placex set indexed_status = 2 where (st_covers(NEW.geometry, placex.geometry) OR ST_Intersects(NEW.geometry, placex.geometry))
|
update placex set indexed_status = 2 where (st_covers(NEW.geometry, placex.geometry) OR ST_Intersects(NEW.geometry, placex.geometry))
|
||||||
AND rank_search > NEW.rank_search and indexed_status = 0 and ST_geometrytype(placex.geometry) != 'ST_Point' and (rank_search < 28 or name is not null or (NEW.rank_search >= 16 and addr_place is not null));
|
AND rank_search > NEW.rank_search and indexed_status = 0 and ST_geometrytype(placex.geometry) != 'ST_Point' and (rank_search < 28 or name is not null or (NEW.rank_search >= 16 and addr_place is not null));
|
||||||
END IF;
|
END IF;
|
||||||
ELSE
|
ELSE
|
||||||
-- mark nearby items for re-indexing, where 'nearby' depends on the features rank_search and is a complete guess :(
|
-- mark nearby items for re-indexing, where 'nearby' depends on the features rank_search and is a complete guess :(
|
||||||
diameter := 0;
|
|
||||||
-- 16 = city, anything higher than city is effectively ignored (polygon required!)
|
|
||||||
IF NEW.type='postcode' THEN
|
|
||||||
diameter := 0.05;
|
|
||||||
ELSEIF NEW.rank_search < 16 THEN
|
|
||||||
diameter := 0;
|
diameter := 0;
|
||||||
ELSEIF NEW.rank_search < 18 THEN
|
-- 16 = city, anything higher than city is effectively ignored (polygon required!)
|
||||||
diameter := 0.1;
|
IF NEW.type='postcode' THEN
|
||||||
ELSEIF NEW.rank_search < 20 THEN
|
diameter := 0.05;
|
||||||
diameter := 0.05;
|
ELSEIF NEW.rank_search < 16 THEN
|
||||||
ELSEIF NEW.rank_search = 21 THEN
|
diameter := 0;
|
||||||
diameter := 0.001;
|
ELSEIF NEW.rank_search < 18 THEN
|
||||||
ELSEIF NEW.rank_search < 24 THEN
|
diameter := 0.1;
|
||||||
diameter := 0.02;
|
ELSEIF NEW.rank_search < 20 THEN
|
||||||
ELSEIF NEW.rank_search < 26 THEN
|
diameter := 0.05;
|
||||||
diameter := 0.002; -- 100 to 200 meters
|
ELSEIF NEW.rank_search = 21 THEN
|
||||||
ELSEIF NEW.rank_search < 28 THEN
|
diameter := 0.001;
|
||||||
diameter := 0.001; -- 50 to 100 meters
|
ELSEIF NEW.rank_search < 24 THEN
|
||||||
END IF;
|
diameter := 0.02;
|
||||||
IF diameter > 0 THEN
|
ELSEIF NEW.rank_search < 26 THEN
|
||||||
-- RAISE WARNING 'placex point insert: % % % % %',NEW.osm_type,NEW.osm_id,NEW.class,NEW.type,diameter;
|
diameter := 0.002; -- 100 to 200 meters
|
||||||
IF NEW.rank_search >= 26 THEN
|
ELSEIF NEW.rank_search < 28 THEN
|
||||||
-- roads may cause reparenting for >27 rank places
|
diameter := 0.001; -- 50 to 100 meters
|
||||||
update placex set indexed_status = 2 where indexed_status = 0 and rank_search > NEW.rank_search and ST_DWithin(placex.geometry, NEW.geometry, diameter);
|
END IF;
|
||||||
ELSEIF NEW.rank_search >= 16 THEN
|
IF diameter > 0 THEN
|
||||||
-- up to rank 16, street-less addresses may need reparenting
|
-- 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 or addr_place is not null);
|
IF NEW.rank_search >= 26 THEN
|
||||||
ELSE
|
-- roads may cause reparenting for >27 rank places
|
||||||
-- 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);
|
||||||
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);
|
ELSEIF NEW.rank_search >= 16 THEN
|
||||||
|
-- up to rank 16, street-less addresses may need reparenting
|
||||||
|
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 or addr_place is not null);
|
||||||
|
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;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
-- add to tables for special search
|
-- add to tables for special search
|
||||||
|
|||||||
Reference in New Issue
Block a user