]> git.openstreetmap.org Git - nominatim.git/commitdiff
Merge pull request #2071 from lonvia/fix-more-ranks
authorSarah Hoffmann <lonvia@denofr.de>
Tue, 24 Nov 2020 20:45:30 +0000 (21:45 +0100)
committerGitHub <noreply@github.com>
Tue, 24 Nov 2020 20:45:30 +0000 (21:45 +0100)
Search rank 30 must always go with address rank 30

sql/functions/ranking.sql
test/bdd/db/import/placex.feature

index 51dcd0d03dd76d937719fb1b45ce00ff17e89307..1f2362114c322077a281f4d59f029181341e3913 100644 (file)
@@ -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;
 
index a9e81c44301a3cc6f9ca87bcf2a9b0ffd5b8e5f8..db36ab58b3e52c7f815ce2addfef7a111c6c3c26 100644 (file)
@@ -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 |