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