]> git.openstreetmap.org Git - nominatim.git/blob - test/bdd/api/search/params.feature
bdd: convert API tests to smaller test db
[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
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,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 Outline: Search with addressdetails
29         When sending <format> search query "Triesen" with address
30         Then address of result 0 is
31           | type         | value |
32           | village      | Triesen |
33           | county       | Oberland |
34           | postcode     | 9495 |
35           | country      | Liechtenstein |
36           | country_code | li |
37
38     Examples:
39           | format |
40           | json   |
41           | jsonv2 |
42           | geojson |
43           | xml |
44
45     Scenario: Coordinate search with addressdetails
46         When sending json search query "47.12400621,9.6047552"
47           | accept-language |
48           | en |
49         Then results contain
50           | display_name |
51           | Guschg, Valorschstrasse, Balzers, Oberland, 9497, Liechtenstein |
52
53     Scenario: Address details with unknown class types
54         When sending json search query "Kloster St. Elisabeth" with address
55         Then results contain
56           | ID | class   | type |
57           | 0  | amenity | monastery |
58         And result addresses contain
59           | ID | amenity |
60           | 0  | Kloster St. Elisabeth |
61
62     Scenario: Disabling deduplication
63         When sending json search query "Malbunstr"
64         Then there are no duplicates
65         When sending json search query "Malbunstr"
66           | dedupe |
67           | 0 |
68         Then there are duplicates
69
70     Scenario: Search with bounded viewbox in right area
71         When sending json search query "bar" with address
72           | bounded | viewbox |
73           | 1       |  9,47,10,48 |
74         Then result addresses contain
75           | ID | town |
76           | 0  | Vaduz |
77         When sending json search query "bar" with address
78           | bounded | viewbox |
79           | 1       |  9.49712,47.17122,9.52605,47.16242 |
80         Then result addresses contain
81           | town |
82           | Schaan |
83
84     Scenario: Country search with bounded viewbox remain in the area
85         When sending json search query "" with address
86           | bounded | viewbox                                 | country |
87           | 1       | 9.49712,47.17122,9.52605,47.16242 | de |
88         Then less than 1 result is returned
89
90     Scenario: Search with bounded viewboxlbrt in right area
91         When sending json search query "bar" with address
92           | bounded | viewboxlbrt |
93           | 1       | 9.49712,47.16242,9.52605,47.17122 |
94         Then result addresses contain
95           | town |
96           | Schaan |
97
98     @Fail
99     Scenario: No POI search with unbounded viewbox
100         When sending json search query "restaurant"
101           | viewbox |
102           | 9.93027,53.61634,10.10073,53.54500 |
103         Then results contain
104           | display_name |
105           | ^[^,]*[Rr]estaurant.* |
106
107     Scenario: bounded search remains within viewbox, even with no results
108          When sending json search query "[restaurant]"
109            | bounded | viewbox |
110            | 1       | 43.5403125,-5.6563282,43.54285,-5.662003 |
111         Then less than 1 result is returned
112
113     Scenario: bounded search remains within viewbox with results
114         When sending json search query "restaurant"
115          | bounded | viewbox |
116          | 1       | 9.49712,47.17122,9.52605,47.16242 |
117         Then result has centroid in 9.49712,47.16242,9.52605,47.17122
118
119     Scenario: Prefer results within viewbox
120         When sending json search query "Gässle" with address
121           | accept-language |
122           | en |
123         Then result addresses contain
124           | ID | town |
125           | 0  | Balzers |
126         When sending json search query "Gässle" with address
127           | accept-language | viewbox |
128           | en              | 9.52413,47.10759,9.53140,47.10539 |
129         Then result addresses contain
130           | ID | village |
131           | 0  | Triesen |
132
133     Scenario: viewboxes cannot be points
134         When sending json search query "foo"
135           | viewbox |
136           | 1.01,34.6,1.01,34.6 |
137         Then a HTTP 400 is returned
138
139     Scenario Outline: viewbox must have four coordinate numbers
140         When sending json search query "foo"
141           | viewbox |
142           | <viewbox> |
143         Then a HTTP 400 is returned
144
145     Examples:
146         | viewbox |
147         | 34      |
148         | 0.003,-84.4 |
149         | 5.2,4.5542,12.4 |
150         | 23.1,-6,0.11,44.2,9.1 |
151
152     Scenario Outline: viewboxlbrt must have four coordinate numbers
153         When sending json search query "foo"
154           | viewboxlbrt |
155           | <viewbox> |
156         Then a HTTP 400 is returned
157
158     Examples:
159         | viewbox |
160         | 34      |
161         | 0.003,-84.4 |
162         | 5.2,4.5542,12.4 |
163         | 23.1,-6,0.11,44.2,9.1 |
164
165     Scenario: Overly large limit number for search results
166         When sending json search query "restaurant"
167           | limit |
168           | 1000 |
169         Then at most 50 results are returned
170
171     Scenario: Limit number of search results
172         When sending json search query "schloss"
173         Then more than 4 results are returned
174         When sending json search query "schloss"
175           | limit |
176           | 4 |
177         Then exactly 4 results are returned
178
179     Scenario: Limit parameter must be a number
180         When sending search query "Blue Laguna"
181           | limit |
182           | );    |
183         Then a HTTP 400 is returned
184
185     Scenario: Restrict to feature type country
186         When sending xml search query "fürstentum"
187         Then results contain
188           | ID | class |
189           | 1  | building |
190         When sending xml search query "fürstentum"
191           | featureType |
192           | country |
193         Then results contain
194           | place_rank |
195           | 4 |
196
197     Scenario: Restrict to feature type state
198         When sending xml search query "Wangerberg"
199         Then more than 1 result is returned
200         When sending xml search query "Wangerberg"
201           | featureType |
202           | state |
203         Then exactly 0 results are returned
204
205     Scenario: Restrict to feature type city
206         When sending xml search query "vaduz"
207         Then results contain
208           | ID | place_rank |
209           | 1  | 30 |
210         When sending xml search query "vaduz"
211           | featureType |
212           | city |
213         Then results contain
214           | place_rank |
215           | 16 |
216
217     Scenario: Restrict to feature type settlement
218         When sending json search query "Malbun"
219         Then results contain
220           | ID | class |
221           | 1  | landuse |
222         When sending json search query "Malbun"
223           | featureType |
224           | settlement |
225         Then results contain
226           | class | type |
227           | place | village |
228
229     Scenario Outline: Search with polygon threshold (json)
230         When sending json search query "switzerland"
231           | polygon_geojson | polygon_threshold |
232           | 1               | <th> |
233         Then at least 1 result is returned
234         And result 0 has attributes geojson
235
236      Examples:
237         | th |
238         | -1 |
239         | 0.0 |
240         | 0.5 |
241         | 999 |
242
243     Scenario Outline: Search with polygon threshold (xml)
244         When sending xml search query "switzerland"
245           | polygon_geojson | polygon_threshold |
246           | 1               | <th> |
247         Then at least 1 result is returned
248         And result 0 has attributes geojson
249
250      Examples:
251         | th |
252         | -1 |
253         | 0.0 |
254         | 0.5 |
255         | 999 |
256
257     Scenario Outline: Search with invalid polygon threshold (xml)
258         When sending xml search query "switzerland"
259           | polygon_geojson | polygon_threshold |
260           | 1               | <th> |
261         Then a HTTP 400 is returned
262
263      Examples:
264         | th |
265         | x |
266         | ;; |
267         | 1m |
268
269     Scenario Outline: Search with extratags
270         When sending <format> search query "Landstr"
271           | extratags |
272           | 1 |
273         Then result has attributes extratags
274
275     Examples:
276         | format |
277         | xml |
278         | json |
279         | jsonv2 |
280         | geojson |
281
282     Scenario Outline: Search with namedetails
283         When sending <format> search query "Landstr"
284           | namedetails |
285           | 1 |
286         Then result has attributes namedetails
287
288     Examples:
289         | format |
290         | xml |
291         | json |
292         | jsonv2 |
293         | geojson |
294
295     Scenario Outline: Search result with contains TEXT geometry
296         When sending <format> search query "triesenberg"
297           | polygon_text |
298           | 1 |
299         Then result has attributes <response_attribute>
300
301     Examples:
302         | format   | response_attribute |
303         | xml      | geotext |
304         | json     | geotext |
305         | jsonv2   | geotext |
306
307     Scenario Outline: Search result contains SVG geometry
308         When sending <format> search query "triesenberg"
309           | polygon_svg |
310           | 1 |
311         Then result has attributes <response_attribute>
312
313     Examples:
314         | format   | response_attribute |
315         | xml      | geosvg |
316         | json     | svg |
317         | jsonv2   | svg |
318
319     Scenario Outline: Search result contains KML geometry
320         When sending <format> search query "triesenberg"
321           | polygon_kml |
322           | 1 |
323         Then result has attributes <response_attribute>
324
325     Examples:
326         | format   | response_attribute |
327         | xml      | geokml |
328         | json     | geokml |
329         | jsonv2   | geokml |
330
331     Scenario Outline: Search result contains GEOJSON geometry
332         When sending <format> search query "triesenberg"
333           | polygon_geojson |
334           | 1 |
335         Then result has attributes <response_attribute>
336
337     Examples:
338         | format   | response_attribute |
339         | xml      | geojson |
340         | json     | geojson |
341         | jsonv2   | geojson |
342         | geojson  | geojson |
343
344     Scenario Outline: Search result in geojson format contains no non-geojson geometry
345         When sending geojson search query "triesenberg"
346           | polygon_text | polygon_svg | polygon_geokml |
347           | 1            | 1           | 1              |
348         Then result 0 has not attributes <response_attribute>
349
350     Examples:
351         | response_attribute |
352         | geotext            |
353         | polygonpoints      |
354         | svg                |
355         | geokml             |
356
357     Scenario: Search along a route
358         When sending json search query "schloss" with address
359         Then result addresses contain
360           | ID | town |
361           | 0  | Vaduz |
362         When sending json search query "schloss" with address
363           | bounded | routewidth | route                              |
364           | 1       | 0.1        |  9.54353,47.11772,9.54314,47.11894 |
365         Then result addresses contain
366           | town |
367           | Triesenberg |
368
369