suppress recursive updates for places that cannot appear in addresses

This commit is contained in:
Sarah Hoffmann
2014-04-11 22:57:00 +02:00
parent 496e1b0616
commit 488cd726ed

View File

@@ -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,6 +1163,7 @@ 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 NEW.rank_address > 0 THEN
IF (ST_GeometryType(NEW.geometry) in ('ST_Polygon','ST_MultiPolygon') AND ST_IsValid(NEW.geometry)) THEN IF (ST_GeometryType(NEW.geometry) in ('ST_Polygon','ST_MultiPolygon') AND ST_IsValid(NEW.geometry)) THEN
-- Performance: We just can't handle re-indexing for country level changes -- Performance: We just can't handle re-indexing for country level changes
IF st_area(NEW.geometry) < 1 THEN IF st_area(NEW.geometry) < 1 THEN
@@ -1209,7 +1210,7 @@ BEGIN
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); 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