]> git.openstreetmap.org Git - nominatim.git/blob - test/bdd/api/search/params.feature
Remove country and state nodes from address computation
[nominatim.git] / test / bdd / api / search / params.feature
1 @APIDB
2 Feature: Search queries
3     Testing different queries and parameters
4
5     Scenario: Simple XML search
6         When sending xml search query "Schaan"
7         Then result 0 has attributes place_id,osm_type,osm_id
8         And result 0 has attributes place_rank,boundingbox
9         And result 0 has attributes lat,lon,display_name
10         And result 0 has attributes class,type,importance,icon
11         And result 0 has not attributes address
12         And result 0 has bounding box in 46.5,47.5,9,10
13
14     Scenario: Simple JSON search
15         When sending json search query "Vaduz"
16         Then result 0 has attributes place_id,licence,icon,class,type
17         And result 0 has attributes osm_type,osm_id,boundingbox
18         And result 0 has attributes lat,lon,display_name,importance
19         And result 0 has not attributes address
20         And result 0 has bounding box in 46.5,47.5,9,10
21
22     Scenario: Unknown formats returns a user error
23         When sending search query "Vaduz"
24           | format |
25           | x45    |
26         Then a HTTP 400 is returned
27
28     Scenario: JSON search with addressdetails
29         When sending json search query "Montevideo" with address
30         Then address of result 0 is
31           | type         | value |
32           | city         | Montevideo |
33           | state        | Montevideo |
34           | country      | Uruguay |
35           | country_code | uy |
36
37     Scenario: XML search with addressdetails
38         When sending xml search query "Aleg" with address
39           | accept-language |
40           | en |
41         Then address of result 0 is
42           | type         | value |
43           | city         | Aleg |
44           | state        | Brakna |
45           | country      | Mauritania |
46           | country_code | mr |
47
48     Scenario: coordinate search with addressdetails
49         When sending json search query "14.271104294939,107.69828796387"
50           | accept-language |
51           | en |
52         Then results contain
53           | display_name |
54           | Plei Ya RĂȘ, Vietnam |
55
56     Scenario: Address details with unknown class types
57         When sending json search query "Hundeauslauf, Hamburg" with address
58         Then results contain
59           | ID | class   | type |
60           | 0  | leisure | dog_park |
61         And result addresses contain
62           | ID | address29 |
63           | 0  | Hundeauslauf |
64         And address of result 0 has no types leisure,dog_park
65
66     Scenario: Disabling deduplication
67         When sending json search query "Sievekingsallee, Hamburg"
68         Then there are no duplicates
69         When sending json search query "Sievekingsallee, Hamburg"
70           | dedupe |
71           | 0 |
72         Then there are duplicates
73
74     Scenario: Search with bounded viewbox in right area
75         When sending json search query "bar" with address
76           | bounded | viewbox |
77           | 1       | -56.16786,-34.84061,-56.12525,-34.86526 |
78         Then result addresses contain
79           | city |
80           | Montevideo |
81
82     Scenario: Country search with bounded viewbox remain in the area
83         When sending json search query "" with address
84           | bounded | viewbox                                 | country |
85           | 1       | -56.16786,-34.84061,-56.12525,-34.86526 | de |
86         Then less than 1 result is returned
87
88     Scenario: Search with bounded viewboxlbrt in right area
89         When sending json search query "bar" with address
90           | bounded | viewboxlbrt |
91           | 1       | -56.16786,-34.86526,-56.12525,-34.84061 |
92         Then result addresses contain
93           | city |
94           | Montevideo |
95
96     Scenario: No POI search with unbounded viewbox
97         When sending json search query "restaurant"
98           | viewbox |
99           | 9.93027,53.61634,10.10073,53.54500 |
100         Then results contain
101           | display_name |
102           | ^[^,]*[Rr]estaurant.* |
103
104     Scenario: bounded search remains within viewbox, even with no results
105          When sending json search query "[restaurant]"
106            | bounded | viewbox |
107            | 1       | 43.5403125,-5.6563282,43.54285,-5.662003 |
108         Then less than 1 result is returned
109
110     Scenario: bounded search remains within viewbox with results
111         When sending json search query "restaurant"
112          | bounded | viewbox |
113          | 1       | 9.93027,53.61634,10.10073,53.54500 |
114         Then result has centroid in 53.54500,53.61634,9.93027,10.10073
115
116     Scenario: Prefer results within viewbox
117         When sending json search query "25 de Mayo" with address
118           | accept-language |
119           | en |
120         Then result addresses contain
121           | ID | state |
122           | 0  | Salto |
123         When sending json search query "25 de Mayo" with address
124           | accept-language | viewbox |
125           | en              | -56.35879,-34.18330,-56.31618,-34.20815 |
126         Then result addresses contain
127           | ID | state |
128           | 0  | Florida |
129
130     Scenario: viewboxes cannot be points
131         When sending json search query "foo"
132           | viewbox |
133           | 1.01,34.6,1.01,34.6 |
134         Then a HTTP 400 is returned
135
136     Scenario Outline: viewbox must have four coordinate numbers
137         When sending json search query "foo"
138           | viewbox |
139           | <viewbox> |
140         Then a HTTP 400 is returned
141
142     Examples:
143         | viewbox |
144         | 34      |
145         | 0.003,-84.4 |
146         | 5.2,4.5542,12.4 |
147         | 23.1,-6,0.11,44.2,9.1 |
148
149     Scenario Outline: viewboxlbrt must have four coordinate numbers
150         When sending json search query "foo"
151           | viewboxlbrt |
152           | <viewbox> |
153         Then a HTTP 400 is returned
154
155     Examples:
156         | viewbox |
157         | 34      |
158         | 0.003,-84.4 |
159         | 5.2,4.5542,12.4 |
160         | 23.1,-6,0.11,44.2,9.1 |
161
162     Scenario: Overly large limit number for search results
163         When sending json search query "restaurant"
164           | limit |
165           | 1000 |
166         Then at most 50 results are returned
167
168     Scenario: Limit number of search results
169         When sending json search query "restaurant"
170           | limit |
171           | 4 |
172         Then exactly 4 results are returned
173
174     Scenario: Limit parameter must be a number
175         When sending search query "Blue Laguna"
176           | limit |
177           | );    |
178         Then a HTTP 400 is returned
179
180     Scenario: Restrict to feature type country
181         When sending xml search query "Uruguay"
182         Then results contain
183           | ID | place_rank |
184           | 1  | 16 |
185         When sending xml search query "Uruguay"
186           | featureType |
187           | country |
188         Then results contain
189           | place_rank |
190           | 4 |
191
192     Scenario: Restrict to feature type state
193         When sending xml search query "Dakota"
194         Then results contain
195           | place_rank |
196           | 12 |
197         When sending xml search query "Dakota"
198           | featureType |
199           | state |
200         Then results contain
201           | place_rank |
202           | 8 |
203
204     Scenario: Restrict to feature type city
205         When sending xml search query "vaduz"
206         Then results contain
207           | ID | place_rank |
208           | 1  | 30 |
209         When sending xml search query "vaduz"
210           | featureType |
211           | city |
212         Then results contain
213           | place_rank |
214           | 16 |
215
216     Scenario: Restrict to feature type settlement
217         When sending json search query "Burg"
218         Then results contain
219           | ID | class |
220           | 1  | amenity |
221         When sending json search query "Burg"
222           | featureType |
223           | settlement |
224         Then results contain
225           | class    | type |
226           | boundary | administrative | 
227
228     Scenario Outline: Search with polygon threshold (json)
229         When sending json search query "switzerland"
230           | polygon_geojson | polygon_threshold |
231           | 1               | <th> |
232         Then at least 1 result is returned
233         And result 0 has attributes geojson
234
235      Examples:
236         | th |
237         | -1 |
238         | 0.0 |
239         | 0.5 |
240         | 999 |
241
242     Scenario Outline: Search with polygon threshold (xml)
243         When sending xml search query "switzerland"
244           | polygon_geojson | polygon_threshold |
245           | 1               | <th> |
246         Then at least 1 result is returned
247         And result 0 has attributes geojson
248
249      Examples:
250         | th |
251         | -1 |
252         | 0.0 |
253         | 0.5 |
254         | 999 |
255
256     Scenario Outline: Search with invalid polygon threshold (xml)
257         When sending xml search query "switzerland"
258           | polygon_geojson | polygon_threshold |
259           | 1               | <th> |
260         Then a HTTP 400 is returned
261
262      Examples:
263         | th |
264         | x |
265         | ;; |
266         | 1m |
267
268     Scenario Outline: Search with extratags
269         When sending <format> search query "Hauptstr"
270           | extratags |
271           | 1 |
272         Then result has attributes extratags
273
274     Examples:
275         | format |
276         | xml |
277         | json |
278         | jsonv2 |
279         | geojson |
280
281     Scenario Outline: Search with namedetails
282         When sending <format> search query "Hauptstr"
283           | namedetails |
284           | 1 |
285         Then result has attributes namedetails
286
287     Examples:
288         | format |
289         | xml |
290         | json |
291         | jsonv2 |
292         | geojson |
293
294     Scenario Outline: Search result with contains TEXT geometry
295         When sending <format> search query "Highmore"
296           | polygon_text |
297           | 1 |
298         Then result has attributes <response_attribute>
299
300     Examples:
301         | format   | response_attribute |
302         | xml      | geotext |
303         | json     | geotext |
304         | jsonv2   | geotext |
305
306     Scenario Outline: Search result contains polygon-as-points geometry
307         When sending <format> search query "Highmore"
308           | polygon |
309           | 1 |
310         Then result has attributes <response_attribute>
311
312     Examples:
313         | format   | response_attribute |
314         | xml      | polygonpoints |
315         | json     | polygonpoints |
316         | jsonv2   | polygonpoints |
317
318     Scenario Outline: Search result contains SVG geometry
319         When sending <format> search query "Highmore"
320           | polygon_svg |
321           | 1 |
322         Then result has attributes <response_attribute>
323
324     Examples:
325         | format   | response_attribute |
326         | xml      | geosvg |
327         | json     | svg |
328         | jsonv2   | svg |
329
330     Scenario Outline: Search result contains KML geometry
331         When sending <format> search query "Highmore"
332           | polygon_kml |
333           | 1 |
334         Then result has attributes <response_attribute>
335
336     Examples:
337         | format   | response_attribute |
338         | xml      | geokml |
339         | json     | geokml |
340         | jsonv2   | geokml |
341
342     Scenario Outline: Search result contains GEOJSON geometry
343         When sending <format> search query "Highmore"
344           | polygon_geojson |
345           | 1 |
346         Then result has attributes <response_attribute>
347
348     Examples:
349         | format   | response_attribute |
350         | xml      | geojson |
351         | json     | geojson |
352         | jsonv2   | geojson |
353         | geojson  | geojson |
354
355     Scenario Outline: Search result in geojson format contains no non-geojson geometry
356         When sending geojson search query "Highmore"
357           | polygon_text | polygon | polygon_svg | polygon_geokml |
358           | 1            | 1       | 1           | 1              |
359         Then result 0 has not attributes <response_attribute>
360
361     Examples:
362         | response_attribute |
363         | geotext            |
364         | polygonpoints      |
365         | svg                |
366         | geokml             |
367
368     Scenario: Search along a route
369         When sending json search query "restaurant" with address
370           | bounded | routewidth | route                                   |
371           | 1       | 0.1        | -103.23255,44.08198,-103.22516,44.08079 |
372         Then result addresses contain
373           | city |
374           | Rapid City |
375
376