]> git.openstreetmap.org Git - nominatim.git/blob - test/bdd/db/import/rank_computation.feature
Merge pull request #1919 from lonvia/tests-for-ranking
[nominatim.git] / test / bdd / db / import / rank_computation.feature
1 @DB
2 Feature: Rank assignment
3     Tests for assignment of search and address ranks.
4
5     Scenario: Ranks for place nodes are assinged according to thier type
6         Given the named places
7           | osm  | class     | type      |
8           | N1   | foo       | bar       |
9           | N11  | place     | Continent |
10           | N12  | place     | continent |
11           | N13  | place     | sea       |
12           | N14  | place     | country   |
13           | N15  | place     | state     |
14           | N16  | place     | region    |
15           | N17  | place     | county    |
16           | N18  | place     | city      |
17           | N19  | place     | island    |
18           | N36  | place     | house               |
19           | N38  | place     | houses              |
20         And the named places
21           | osm  | class     | type      | extra+capital |
22           | N101 | place     | city      | yes |
23         When importing
24         Then placex contains
25           | object | rank_search | rank_address |
26           | N1     | 30          | 30 |
27           | N11    | 30          | 30 |
28           | N12    | 2           | 0 |
29           | N13    | 2           | 0 |
30           | N14    | 4           | 0 |
31           | N15    | 8           | 0 |
32           | N16    | 18          | 0 |
33           | N17    | 12          | 12 |
34           | N18    | 16          | 16 |
35           | N19    | 17          | 0 |
36           | N101   | 15          | 16 |
37           | N36    | 30          | 30 |
38           | N38    | 28          | 0 |
39
40     Scenario: Ranks for boundaries are assigned according to admin level
41         Given the named places
42           | osm | class    | type           | admin | geometry |
43           | R20 | boundary | administrative | 2     | (1 1, 2 2, 1 2, 1 1) |
44           | R21 | boundary | administrative | 32    | (3 3, 4 4, 3 4, 3 3) |
45           | R22 | boundary | administrative | 6     | (0 0, 1 0, 0 1, 0 0) |
46           | R23 | boundary | administrative | 10    | (0 0, 1 1, 1 0, 0 0) |
47         When importing
48         Then placex contains
49           | object | rank_search | rank_address |
50           | R20    | 4           | 4 |
51           | R21    | 30          | 30 |
52           | R22    | 12          | 12 |
53           | R23    | 20          | 20 |
54
55     Scenario: Ranks for boundaries with place assignment go with place address ranks if available
56         Given the named places
57           | osm | class    | type           | admin | extra+place | geometry |
58           | R20 | boundary | administrative | 3     | state       | (1 1, 2 2, 1 2, 1 1) |
59           | R21 | boundary | administrative | 32    | suburb      | (3 3, 4 4, 3 4, 3 3) |
60           | R22 | boundary | administrative | 6     | town        | (0 0, 1 0, 0 1, 0 0) |
61           | R23 | boundary | administrative | 10    | village     | (0 0, 1 1, 1 0, 0 0) |
62         When importing
63         Then placex contains
64           | object | rank_search | rank_address |
65           | R20    | 6           | 6  |
66           | R21    | 30          | 20 |
67           | R22    | 12          | 16 |
68           | R23    | 20          | 16 |
69
70     Scenario: Place address ranks cannot overtake a parent address rank
71         Given the named places
72           | osm | class    | type           | admin | extra+place  | geometry |
73           | R20 | boundary | administrative | 8     | town         | (0 0, 0 2, 2 2, 2 0, 0 0) |
74           | R21 | boundary | administrative | 9     | municipality | (0 0, 0 1, 1 1, 1 0, 0 0) |
75           | R22 | boundary | administrative | 9     | suburb       | (0 0, 0 1, 1 1, 1 0, 0 0) |
76         When importing
77         Then place_addressline contains
78             | object | address | cached_rank_address |
79             | R21    | R20     | 16                  |
80             | R22    | R20     | 16                  |
81         Then placex contains
82           | object | rank_search | rank_address |
83           | R20    | 16          | 16 |
84           | R21    | 18          | 18 |
85           | R22    | 18          | 20 |
86
87     Scenario: Admin levels cannot overtake each other due to place address ranks
88         Given the named places
89           | osm | class    | type           | admin | extra+place  | geometry |
90           | R20 | boundary | administrative | 6     | town         | (0 0, 0 2, 2 2, 2 0, 0 0) |
91           | R21 | boundary | administrative | 8     |              | (0 0, 0 1, 1 1, 1 0, 0 0) |
92           | R22 | boundary | administrative | 8     | suburb       | (0 0, 0 1, 1 1, 1 0, 0 0) |
93         When importing
94         Then placex contains
95           | object | rank_search | rank_address |
96           | R20    | 12          | 16 |
97           | R21    | 16          | 18 |
98           | R22    | 16          | 20 |
99         Then place_addressline contains
100             | object | address | cached_rank_address |
101             | R21    | R20     | 16                  |
102             | R22    | R20     | 16                  |
103
104     Scenario: Admin levels must not be larger than 25
105         Given the named places
106           | osm | class    | type           | admin | extra+place   | geometry |
107           | R20 | boundary | administrative | 6     | neighbourhood | (0 0, 0 2, 2 2, 2 0, 0 0) |
108           | R21 | boundary | administrative | 7     |               | (0 0, 0 1, 1 1, 1 0, 0 0) |
109           | R22 | boundary | administrative | 8     |               | (0 0, 0 0.5, 0.5 0.5, 0.5 0, 0 0) |
110         When importing
111         Then placex contains
112           | object | rank_search | rank_address |
113           | R20    | 12          | 22 |
114           | R21    | 14          | 24 |
115           | R22    | 16          | 25 |