]> git.openstreetmap.org Git - nominatim.git/blob - test/bdd/features/db/import/search_name.feature
when rematching only distinguish between perfect, somewhat and bad match
[nominatim.git] / test / bdd / features / db / import / search_name.feature
1 Feature: Creation of search terms
2     Tests that search_name table is filled correctly
3
4     Scenario: Semicolon-separated names appear as separate full names
5         Given the places
6          | osm | class   | type | name+alt_name |
7          | N1  | place   | city | New York; Big Apple |
8          | N2  | place   | town | New York Big Apple |
9         When importing
10         And geocoding "New York Big Apple"
11         Then result 0 contains
12          | object |
13          | N2     |
14
15     Scenario: Comma-separated names appear as a single full name
16         Given the places
17          | osm | class   | type | name+name |
18          | N1  | place   | city | New York, Big Apple |
19          | N2  | place   | town | New York Big Apple |
20         When importing
21         And geocoding "New York Big Apple"
22         Then result 0 contains
23          | object |
24          | N1     |
25
26     Scenario: Name parts before brackets appear as full names
27         Given the places
28          | osm | class   | type | name+name |
29          | N1  | place   | city | Halle (Saale) |
30          | N2  | place   | town | Halle |
31         When importing
32         And geocoding "Halle"
33         Then result 0 contains
34          | object |
35          | N1     |
36         When geocoding "Halle (Saale)"
37         Then the result set contains
38          | object |
39          | N1 |
40
41     Scenario: Unknown addr: tags can be found for unnamed POIs
42         Given the grid
43          |    | 1 |  |    |
44          | 10 |   |  | 11 |
45         And the places
46          | osm | class   | type        | housenr | addr+city |
47          | N1  | place   | house       | 23      | Walltown  |
48         And the places
49          | osm | class   | type        | name+name   | geometry |
50          | W1  | highway | residential | Rose Street | 10,11    |
51         When importing
52         When geocoding "23 Rose Street, Walltown"
53         Then the result set contains
54          | object | display_name |
55          | N1     | 23, Rose Street |
56         When geocoding "Walltown, Rose Street 23"
57         Then the result set contains
58          | object | display_name |
59          | N1     | 23, Rose Street |
60         When geocoding "Rose Street 23, Walltown"
61         Then the result set contains
62          | object | display_name |
63          | N1     | 23, Rose Street |
64
65     Scenario: Searching for unknown addr: tags also works for multiple words
66         Given the grid
67          |    | 1 |  |    |
68          | 10 |   |  | 11 |
69         And the places
70          | osm | class   | type        | housenr | addr+city        |
71          | N1  | place   | house       | 23      | Little Big Town  |
72         And the places
73          | osm | class   | type        | name+name   | geometry |
74          | W1  | highway | residential | Rose Street | 10,11    |
75         When importing
76         When geocoding "23 Rose Street, Little Big Town"
77         Then the result set contains
78          | object | display_name |
79          | N1     | 23, Rose Street |
80         When geocoding "Rose Street 23, Little Big Town"
81         Then the result set contains
82          | object | display_name |
83          | N1     | 23, Rose Street |
84         When geocoding "Little big Town, Rose Street 23"
85         Then the result set contains
86          | object | display_name |
87          | N1     | 23, Rose Street |
88
89      Scenario: Unnamed POI can be found when it has known addr: tags
90         Given the grid
91          |    | 1 |  |    |
92          | 10 |   |  | 11 |
93         And the places
94          | osm | class   | type        | housenr | addr+city |
95          | N1  | place   | house       | 23      | Walltown  |
96         And the places
97          | osm | class   | type        | name+name   | addr+city | geometry |
98          | W1  | highway | residential | Rose Street | Walltown  | 10,11    |
99         When importing
100         When geocoding "23 Rose Street, Walltown"
101         Then the result set contains
102          | object | display_name |
103          | N1     | 23, Rose Street |
104
105     Scenario: Unnamed POIs inherit parent name when unknown addr:place is present
106         Given the grid
107          | 100 |    |   |   |    | 101 |
108          |     |    | 1 |   |    |     |
109          | 103 | 10 |   |   | 11 | 102 |
110         And the places
111          | osm | class   | type        | housenr | addr+place |
112          | N1  | place   | house       | 23      | Walltown   |
113         And the places
114          | osm | class   | type        | name+name    | geometry |
115          | W1  | highway | residential | Rose Street  | 10,11    |
116          | R1  | place   | city        | Strange Town | (100,101,102,103,100) |
117         When importing
118         Then placex contains
119          | object | parent_place_id |
120          | N1     | R1              |
121         When geocoding "23 Rose Street"
122         Then all results contain
123          | object | display_name |
124          | W1     | Rose Street, Strange Town |
125         When geocoding "23 Walltown, Strange Town"
126         Then the result set contains
127          | object | display_name |
128          | N1     | 23, Walltown, Strange Town |
129         When geocoding "Walltown 23, Strange Town"
130         Then the result set contains
131          | object | display_name |
132          | N1     | 23, Walltown, Strange Town |
133         When geocoding "Strange Town, Walltown 23"
134         Then the result set contains
135          | object | display_name |
136          | N1     | 23, Walltown, Strange Town |
137
138     Scenario: Named POIs can be searched by housenumber when unknown addr:place is present
139         Given the grid
140          | 100 |    |   |   |    | 101 |
141          |     |    | 1 |   |    |     |
142          | 103 | 10 |   |   | 11 | 102 |
143         And the places
144          | osm | class   | type  | name       | housenr | addr+place |
145          | N1  | place   | house | Blue house | 23      | Walltown   |
146         And the places
147          | osm | class   | type        | name+name    | geometry |
148          | W1  | highway | residential | Rose Street  | 10,11 |
149          | R1  | place   | city        | Strange Town | (100,101,102,103,100) |
150         When importing
151         When geocoding "23 Walltown, Strange Town"
152         Then the result set contains
153          | object | display_name |
154          | N1     | Blue house, 23, Walltown, Strange Town |
155         When geocoding "Walltown 23, Strange Town"
156         Then the result set contains
157          | object | display_name |
158          | N1     | Blue house, 23, Walltown, Strange Town |
159         When geocoding "Strange Town, Walltown 23"
160         Then the result set contains
161          | object | display_name |
162          | N1     | Blue house, 23, Walltown, Strange Town |
163         When geocoding "Strange Town, Walltown 23, Blue house"
164         Then the result set contains
165          | object | display_name |
166          | N1     | Blue house, 23, Walltown, Strange Town |
167         When geocoding "Strange Town, Walltown, Blue house"
168         Then the result set contains
169          | object | display_name |
170          | N1     | Blue house, 23, Walltown, Strange Town |
171
172     Scenario: Named POIs can be found when unknown multi-word addr:place is present
173         Given the grid
174          | 100 |    |   |   |    | 101 |
175          |     |    | 1 |   |    |     |
176          | 103 | 10 |   |   | 11 | 102 |
177         And the places
178          | osm | class   | type  | name       | housenr | addr+place |
179          | N1  | place   | house | Blue house | 23      | Moon sun   |
180         And the places
181          | osm | class   | type        | name+name    | geometry |
182          | W1  | highway | residential | Rose Street  | 10,11    |
183          | R1  | place   | city        | Strange Town | (100,101,102,103,100) |
184         When importing
185         When geocoding "23 Moon Sun, Strange Town"
186         Then the result set contains
187          | object | display_name |
188          | N1     | Blue house, 23, Moon sun, Strange Town |
189         When geocoding "Blue house, Moon Sun, Strange Town"
190         Then the result set contains
191          | object | display_name |
192          | N1     | Blue house, 23, Moon sun, Strange Town |
193
194     Scenario: Unnamed POIs doesn't inherit parent name when addr:place is present only in parent address
195         Given the grid
196          | 100 |    |   |   |    | 101 |
197          |     |    | 1 |   |    |     |
198          | 103 | 10 |   |   | 11 | 102 |
199         And the places
200          | osm | class   | type        | housenr | addr+place |
201          | N1  | place   | house       | 23      | Walltown   |
202         And the places
203          | osm | class   | type        | name+name    | addr+city | geometry |
204          | W1  | highway | residential | Rose Street  | Walltown  | 10,11    |
205          | R1  | place   | suburb      | Strange Town | Walltown  | (100,101,102,103,100) |
206         When importing
207         When geocoding "23 Rose Street, Walltown"
208         Then all results contain
209          | object | display_name |
210          | W1     | Rose Street, Strange Town |
211         When geocoding "23  Walltown"
212         Then all results contain
213          | object | display_name |
214          | N1     | 23, Walltown, Strange Town |
215
216     Scenario: Unnamed POIs does inherit parent name when unknown addr:place and addr:street is present
217         Given the grid
218          |    | 1 |  |    |
219          | 10 |   |  | 11 |
220         And the places
221          | osm | class   | type   | housenr | addr+place | addr+street |
222          | N1  | place   | house  | 23      | Walltown   | Lily Street |
223         And the places
224          | osm | class   | type        | name+name   | geometry |
225          | W1  | highway | residential | Rose Street | 10,11    |
226         When importing
227         When geocoding "23 Rose Street"
228         Then the result set contains
229          | object | display_name |
230          | N1     | 23, Rose Street |
231         When geocoding "23 Lily Street"
232         Then exactly 0 results are returned
233
234     Scenario: An unknown addr:street is ignored
235         Given the grid
236          |    | 1 |  |    |
237          | 10 |   |  | 11 |
238         And the places
239          | osm | class   | type   | housenr |  addr+street |
240          | N1  | place   | house  | 23      |  Lily Street |
241         And the places
242          | osm | class   | type        | name+name   | geometry |
243          | W1  | highway | residential | Rose Street | 10,11    |
244         When importing
245         When geocoding "23 Rose Street"
246         Then the result set contains
247          | object | display_name |
248          | N1     | 23, Rose Street |
249         When geocoding "23 Lily Street"
250         Then exactly 0 results are returned
251
252     Scenario: Named POIs can be found through unknown address tags
253         Given the grid
254          |    | 1 |  |    |
255          | 10 |   |  | 11 |
256         And the places
257          | osm | class   | type        | name+name  | housenr | addr+city |
258          | N1  | place   | house       | Green Moss | 26      | Walltown  |
259         And the places
260          | osm | class   | type        | name+name   | geometry |
261          | W1  | highway | residential | Rose Street | 10,11    |
262         When importing
263         When geocoding "Green Moss, Rose Street, Walltown"
264         Then the result set contains
265          | object | display_name |
266          | N1     | Green Moss, 26, Rose Street |
267         When geocoding "Green Moss, 26, Rose Street, Walltown"
268         Then the result set contains
269          | object | display_name |
270          | N1     | Green Moss, 26, Rose Street |
271         When geocoding "26, Rose Street, Walltown"
272         Then the result set contains
273          | object | display_name |
274          | N1     | Green Moss, 26, Rose Street |
275         When geocoding "Rose Street 26, Walltown"
276         Then the result set contains
277          | object | display_name |
278          | N1     | Green Moss, 26, Rose Street |
279         When geocoding "Walltown, Rose Street 26"
280         Then the result set contains
281          | object | display_name |
282          | N1     | Green Moss, 26, Rose Street |
283
284     Scenario: Named POI doesn't inherit parent name when addr:place is present only in parent address
285         Given the grid
286          | 100 |    |   |   |    | 101 |
287          |     |    | 1 |   |    |     |
288          | 103 | 10 |   |   | 11 | 102 |
289         And the places
290          | osm | class   | type        | name+name  | addr+place |
291          | N1  | place   | house       | Green Moss | Walltown   |
292         And the places
293          | osm | class   | type        | name+name    | geometry |
294          | W1  | highway | residential | Rose Street  | 10,11    |
295          | R1  | place   | suburb      | Strange Town | (100,101,102,103,100) |
296         When importing
297         When geocoding "Green Moss, Rose Street, Walltown"
298         Then exactly 0 results are returned
299         When geocoding "Green Moss, Walltown"
300         Then the result set contains
301          | object | display_name |
302          | N1     | Green Moss, Walltown, Strange Town |
303
304     Scenario: Named POIs inherit address from parent
305         Given the grid
306          |    | 1 |  |    |
307          | 10 |   |  | 11 |
308         And the places
309          | osm | class   | type        | name     | geometry |
310          | N1  | place   | house       | foo      | 1        |
311          | W1  | highway | residential | the road | 10,11    |
312         When importing
313         When geocoding "foo, the road"
314         Then all results contain
315          | object |
316          | N1     |
317
318     Scenario: Some addr: tags are added to address
319         Given the grid
320          |    | 2 | 3 |    |
321          | 10 |   |   | 11 |
322         And the places
323          | osm | class   | type        | name     |
324          | N2  | place   | city        | bonn     |
325          | N3  | place   | suburb      | smalltown|
326         And the places
327          | osm | class   | type    | name    | addr+city | addr+municipality | addr+suburb | geometry |
328          | W1  | highway | service | the end | bonn      | New York          | Smalltown   | 10,11    |
329         When importing
330         When geocoding "the end, new york, bonn, smalltown"
331         Then all results contain
332          | object |
333          | W1     |
334
335     Scenario: A known addr:* tag is added even if the name is unknown
336         Given the grid
337          | 10 | | | | 11 |
338         And the places
339          | osm | class   | type        | name | addr+city | geometry |
340          | W1  | highway | residential | Road | Nandu     | 10,11    |
341         When importing
342         And geocoding "Road, Nandu"
343         Then all results contain
344          | object |
345          | W1     |
346
347     Scenario: a linked place does not show up in search name
348         Given the 0.01 grid
349          | 10 |   | 11 |
350          |    | 2 |    |
351          | 13 |   | 12 |
352         Given the places
353          | osm  | class    | type           | name | admin | geometry |
354          | R13  | boundary | administrative | Roma | 9     | (10,11,12,13,10) |
355         And the places
356          | osm  | class    | type           | name |
357          | N2   | place    | city           | Cite |
358         And the relations
359          | id | members       | tags+type |
360          | 13 | N2:label      | boundary |
361         When importing
362         Then placex contains
363          | object | linked_place_id |
364          | N2     | R13             |
365         When geocoding "Cite"
366         Then all results contain
367          | object |
368          | R13 |
369
370     Scenario: a linked waterway does not show up in search name
371         Given the grid
372          | 1 | | 2 | | 3 |
373         And the places
374          | osm | class    | type  | name  | geometry |
375          | W1  | waterway | river | Rhein | 1,2      |
376          | W2  | waterway | river | Rhein | 2,3      |
377          | R13 | waterway | river | Rhein | 1,2,3    |
378         And the relations
379          | id | members            | tags+type |
380          | 13 | W1,W2:main_stream  | waterway |
381         When importing
382         Then placex contains
383          | object | linked_place_id |
384          | W1     | R13 |
385          | W2     | R13 |
386         When geocoding "Rhein"
387         Then all results contain
388          | object |
389          | R13 |