]> git.openstreetmap.org Git - nominatim.git/blob - tests/features/db/import/naming.feature
add functional tests
[nominatim.git] / tests / features / db / import / naming.feature
1 @DB
2 Feature: Import and search of names
3     Tests all naming related issues: normalisation,
4     abbreviations, internationalisation, etc.
5
6
7     Scenario: Case-insensitivity of search
8         Given the place nodes
9           | osm_id | class | type      | name
10           | 1      | place | locality  | 'name' : 'FooBar'
11         When importing
12         Then table placex contains
13           | object | class  | type     | name
14           | N1     | place  | locality | 'name' : 'FooBar'
15         When sending query "FooBar"
16         Then results contain
17          | ID | osm_type | osm_id
18          | 0  | N        | 1
19         When sending query "foobar"
20         Then results contain
21          | ID | osm_type | osm_id
22          | 0  | N        | 1
23         When sending query "fOObar"
24         Then results contain
25          | ID | osm_type | osm_id
26          | 0  | N        | 1
27         When sending query "FOOBAR"
28         Then results contain
29          | ID | osm_type | osm_id
30          | 0  | N        | 1
31
32     Scenario: Multiple spaces in name
33         Given the place nodes
34           | osm_id | class | type      | name
35           | 1      | place | locality  | 'name' : 'one two  three'
36         When importing
37         When sending query "one two three"
38         Then results contain
39          | ID | osm_type | osm_id
40          | 0  | N        | 1
41         When sending query "one   two three"
42         Then results contain
43          | ID | osm_type | osm_id
44          | 0  | N        | 1
45         When sending query "one two  three"
46         Then results contain
47          | ID | osm_type | osm_id
48          | 0  | N        | 1
49         When sending query "    one two three"
50         Then results contain
51          | ID | osm_type | osm_id
52          | 0  | N        | 1
53
54     Scenario: Special characters in name
55         Given the place nodes
56           | osm_id | class | type      | name
57           | 1      | place | locality  | 'name' : 'Jim-Knopf-Str'
58           | 2      | place | locality  | 'name' : 'Smith/Weston'
59           | 3      | place | locality  | 'name' : 'space mountain'
60           | 4      | place | locality  | 'name' : 'space'
61           | 5      | place | locality  | 'name' : 'mountain'
62         When importing
63         When sending query "Jim-Knopf-Str"
64         Then results contain
65          | ID | osm_type | osm_id
66          | 0  | N        | 1
67         When sending query "Jim Knopf-Str"
68         Then results contain
69          | ID | osm_type | osm_id
70          | 0  | N        | 1
71         When sending query "Jim Knopf Str"
72         Then results contain
73          | ID | osm_type | osm_id
74          | 0  | N        | 1
75         When sending query "Jim/Knopf-Str"
76         Then results contain
77          | ID | osm_type | osm_id
78          | 0  | N        | 1
79         When sending query "Jim-Knopfstr"
80         Then results contain
81          | ID | osm_type | osm_id
82          | 0  | N        | 1
83         When sending query "Smith/Weston"
84         Then results contain
85          | ID | osm_type | osm_id
86          | 0  | N        | 2
87         When sending query "Smith Weston"
88         Then results contain
89          | ID | osm_type | osm_id
90          | 0  | N        | 2
91         When sending query "Smith-Weston"
92         Then results contain
93          | ID | osm_type | osm_id
94          | 0  | N        | 2
95         When sending query "space mountain"
96         Then results contain
97          | ID | osm_type | osm_id
98          | 0  | N        | 3
99         When sending query "space-mountain"
100         Then results contain
101          | ID | osm_type | osm_id
102          | 0  | N        | 3
103         When sending query "space/mountain"
104         Then results contain
105          | ID | osm_type | osm_id
106          | 0  | N        | 3
107         When sending query "space\mountain"
108         Then results contain
109          | ID | osm_type | osm_id
110          | 0  | N        | 3
111         When sending query "space(mountain)"
112         Then results contain
113          | ID | osm_type | osm_id
114          | 0  | N        | 3
115
116     Scenario: No copying name tag if only one name
117         Given the place nodes
118           | osm_id | class | type      | name              | geometry
119           | 1      | place | locality  | 'name' : 'german' | country:de
120         When importing
121         Then table placex contains
122           | object | calculated_country_code |
123           | N1     | de
124         And table placex contains as names for N1
125           | object | k       | v
126           | N1     | name    | german
127
128     Scenario: Copying name tag to default language if it does not exist
129         Given the place nodes
130           | osm_id | class | type      | name                                     | geometry
131           | 1      | place | locality  | 'name' : 'german', 'name:fi' : 'finnish' | country:de
132         When importing
133         Then table placex contains
134           | object | calculated_country_code |
135           | N1     | de
136         And table placex contains as names for N1
137           | k       | v
138           | name    | german
139           | name:fi | finnish
140           | name:de | german
141
142     Scenario: Copying default language name tag to name if it does not exist
143         Given the place nodes
144           | osm_id | class | type      | name                                        | geometry
145           | 1      | place | locality  | 'name:de' : 'german', 'name:fi' : 'finnish' | country:de
146         When importing
147         Then table placex contains
148           | object | calculated_country_code |
149           | N1     | de
150         And table placex contains as names for N1
151           | k       | v
152           | name    | german
153           | name:fi | finnish
154           | name:de | german
155
156     Scenario: Do not overwrite default language with name tag
157         Given the place nodes
158           | osm_id | class | type      | name                                                          | geometry
159           | 1      | place | locality  | 'name' : 'german', 'name:fi' : 'finnish', 'name:de' : 'local' | country:de
160         When importing
161         Then table placex contains
162           | object | calculated_country_code |
163           | N1     | de
164         And table placex contains as names for N1
165           | k       | v
166           | name    | german
167           | name:fi | finnish
168           | name:de | local
169
170     Scenario: Landuse without name are ignored
171         Given the place areas
172           | osm_type | osm_id | class    | type        | geometry
173           | R        | 1      | natural  | meadow      | (0 0, 1 0, 1 1, 0 1, 0 0)
174           | R        | 2      | landuse  | industrial  | (0 0, -1 0, -1 -1, 0 -1, 0 0)
175         When importing
176         Then table placex has no entry for R1
177         And table placex has no entry for R2
178
179     Scenario: Landuse with name are found
180         Given the place areas
181           | osm_type | osm_id | class    | type        | name                | geometry
182           | R        | 1      | natural  | meadow      | 'name' : 'landuse1' | (0 0, 1 0, 1 1, 0 1, 0 0)
183           | R        | 2      | landuse  | industrial  | 'name' : 'landuse2' | (0 0, -1 0, -1 -1, 0 -1, 0 0)
184         When importing
185         When sending query "landuse1"
186         Then results contain
187          | ID | osm_type | osm_id
188          | 0  | R        | 1
189         When sending query "landuse2"
190         Then results contain
191          | ID | osm_type | osm_id
192          | 0  | R        | 2
193
194     Scenario: Postcode boundaries without ref
195         Given the place areas
196           | osm_type | osm_id | class    | type        | postcode | geometry
197           | R        | 1      | boundary | postal_code | 12345    | (0 0, 1 0, 1 1, 0 1, 0 0)
198         When importing
199         When sending query "12345"
200         Then results contain
201          | ID | osm_type | osm_id
202          | 0  | R        | 1