Import class:type from linked features to the extratags files. Use place tags (in extratags) as well as rank to determine feature type. i.e. allow a admin_level=6 feature also tagged as a place=city to still be found when doing a city search.

This commit is contained in:
Brian Quinion
2013-02-28 12:47:13 +00:00
parent f201371c50
commit b980f8e4e1
2 changed files with 47 additions and 12 deletions

View File

@@ -1590,7 +1590,7 @@ BEGIN
-- merge in the label name, re-init word vector
IF NOT linkedPlacex.name IS NULL THEN
NEW.name := linkedPlacex.name || NEW.name;
name_vector := make_keywords(NEW.name);
name_vector := array_merge(name_vector, make_keywords(linkedPlacex.name));
END IF;
-- merge in extra tags
@@ -1598,6 +1598,10 @@ BEGIN
NEW.extratags := linkedPlacex.extratags || NEW.extratags;
END IF;
IF NOT NEW.extratags ? linkedPlacex.class THEN
NEW.extratags := NEW.extratags || hstore(linkedPlacex.class, linkedPlacex.type);
END IF;
-- mark the linked place (excludes from search results)
UPDATE placex set linked_place_id = NEW.place_id where place_id = linkedPlacex.place_id;
@@ -1617,7 +1621,6 @@ BEGIN
IF make_standard_name(NEW.name->'name') = make_standard_name(linkedPlacex.name->'name')
AND NEW.rank_address = linkedPlacex.rank_address THEN
-- If we don't already have one use this as the centre point of the geometry
IF NEW.centroid IS NULL THEN
NEW.centroid := coalesce(linkedPlacex.centroid,st_centroid(linkedPlacex.geometry));
@@ -1634,6 +1637,10 @@ BEGIN
NEW.extratags := linkedPlacex.extratags || NEW.extratags;
END IF;
IF NOT NEW.extratags ? linkedPlacex.class THEN
NEW.extratags := NEW.extratags || hstore(linkedPlacex.class, linkedPlacex.type);
END IF;
-- mark the linked place (excludes from search results)
UPDATE placex set linked_place_id = NEW.place_id where place_id = linkedPlacex.place_id;
@@ -1671,6 +1678,10 @@ BEGIN
-- merge in extra tags
NEW.extratags := linkedPlacex.extratags || NEW.extratags;
IF NOT NEW.extratags ? linkedPlacex.class THEN
NEW.extratags := NEW.extratags || hstore(linkedPlacex.class, linkedPlacex.type);
END IF;
-- mark the linked place (excludes from search results)
UPDATE placex set linked_place_id = NEW.place_id where place_id = linkedPlacex.place_id;