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