From b4b50eef158951739e22d2b2380d780957f82c8d Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Tue, 24 Nov 2020 17:13:24 +0100 Subject: [PATCH] search rank 30 must always go with address rank 30 --- sql/functions/ranking.sql | 9 +++------ test/bdd/db/import/placex.feature | 6 +++--- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/sql/functions/ranking.sql b/sql/functions/ranking.sql index 51dcd0d0..1f236211 100644 --- a/sql/functions/ranking.sql +++ b/sql/functions/ranking.sql @@ -194,10 +194,10 @@ BEGIN FROM get_postcode_rank(country, postcode); ELSEIF extended_type = 'N' AND place_class = 'highway' THEN search_rank = 30; - address_rank = 0; + address_rank = 30; ELSEIF place_class = 'landuse' AND extended_type != 'A' THEN search_rank = 30; - address_rank = 0; + address_rank = 30; ELSE IF place_class = 'boundary' and place_type = 'administrative' THEN classtype = place_type || admin_level::TEXT; @@ -211,11 +211,8 @@ BEGIN AND l.class = place_class AND (l.type = classtype or l.type is NULL) ORDER BY l.country_code, l.class, l.type LIMIT 1; - IF search_rank is NULL THEN + IF search_rank is NULL OR address_rank is NULL THEN search_rank := 30; - END IF; - - IF address_rank is NULL THEN address_rank := 30; END IF; diff --git a/test/bdd/db/import/placex.feature b/test/bdd/db/import/placex.feature index a9e81c44..db36ab58 100644 --- a/test/bdd/db/import/placex.feature +++ b/test/bdd/db/import/placex.feature @@ -170,7 +170,7 @@ Feature: Import into placex When importing Then placex contains | object | rank_search | rank_address | - | N1 | 30 | 0 | + | N1 | 30 | 30 | | W1 | 26 | 26 | | W2 | 26 | 26 | | W3 | 26 | 26 | @@ -191,8 +191,8 @@ Feature: Import into placex When importing Then placex contains | object | rank_search | rank_address | - | N2 | 30 | 0 | - | W2 | 30 | 0 | + | N2 | 30 | 30 | + | W2 | 30 | 30 | | W4 | 22 | 22 | | R2 | 22 | 22 | | R3 | 22 | 0 | -- 2.45.2