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