remove postcodes entirely from indexing

place=postcode places are artificial places that collect addr:postcode
points for aggration. They should neither show up in the address nor
be searchable. That means that there is no need to index them at all.
Only let boundary=postal_code through which define correct areas for
postcodes.
This commit is contained in:
Sarah Hoffmann
2020-09-18 15:09:35 +02:00
parent 7fb62ea904
commit 4c9cfe2532
4 changed files with 30 additions and 25 deletions

View File

@@ -581,6 +581,15 @@ BEGIN
RETURN NEW;
END IF;
-- Postcodes are just here to compute the centroids. They are not searchable
-- unless they are a boundary=postal_code.
-- There was an error in the style so that boundary=postal_code used to be
-- imported as place=postcode. That's why relations are allowed to pass here.
-- This can go away in a couple of versions.
IF NEW.class = 'place' and NEW.type = 'postcode' and NEW.osm_type != 'R' THEN
RETURN NEW;
END IF;
-- Speed up searches - just use the centroid of the feature
-- cheaper but less acurate
NEW.centroid := ST_PointOnSurface(NEW.geometry);

View File

@@ -145,10 +145,6 @@ BEGIN
THEN
SELECT * INTO search_rank, address_rank
FROM get_postcode_rank(country, postcode);
IF NOT extended_type = 'A' THEN
address_rank := 0;
END IF;
ELSEIF extended_type = 'N' AND place_class = 'highway' THEN
search_rank = 30;
address_rank = 0;