]> git.openstreetmap.org Git - nominatim.git/blob - test/bdd/api/search/params.feature
Merge pull request #2039 from lonvia/migration-for-ui
[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: 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 | leisure |
63           | 0  | Hundeauslauf |
64
65     Scenario: Disabling deduplication
66         When sending json search query "Sievekingsallee, Hamburg"
67         Then there are no duplicates
68         When sending json search query "Sievekingsallee, Hamburg"
69           | dedupe |
70           | 0 |
71         Then there are duplicates
72
73     Scenario: Search with bounded viewbox in right area
74         When sending json search query "bar" with address
75           | bounded | viewbox |
76           | 1       | -56.16786,-34.84061,-56.12525,-34.86526 |
77         Then result addresses contain
78           | city |
79           | Montevideo |
80
81     Scenario: Country search with bounded viewbox remain in the area
82         When sending json search query "" with address
83           | bounded | viewbox                                 | country |
84           | 1       | -56.16786,-34.84061,-56.12525,-34.86526 | de |
85         Then less than 1 result is returned
86
87     Scenario: Search with bounded viewboxlbrt in right area
88         When sending json search query "bar" with address
89           | bounded | viewboxlbrt |
90           | 1       | -56.16786,-34.86526,-56.12525,-34.84061 |
91         Then result addresses contain
92           | city |
93           | Montevideo |
94
95     Scenario: No POI search with unbounded viewbox
96         When sending json search query "restaurant"
97           | viewbox |
98           | 9.93027,53.61634,10.10073,53.54500 |
99         Then results contain
100           | display_name |
101           | ^[^,]*[Rr]estaurant.* |
102
103     Scenario: bounded search remains within viewbox, even with no results
104          When sending json search query "[restaurant]"
105            | bounded | viewbox |
106            | 1       | 43.5403125,-5.6563282,43.54285,-5.662003 |
107         Then less than 1 result is returned
108
109     Scenario: bounded search remains within viewbox with results
110         When sending json search query "restaurant"
111          | bounded | viewbox |
112          | 1       | 9.93027,53.61634,10.10073,53.54500 |
113         Then result has centroid in 53.54500,53.61634,9.93027,10.10073
114
115     Scenario: Prefer results within viewbox
116         When sending json search query "25 de Mayo" with address
117           | accept-language |
118           | en |
119         Then result addresses contain
120           | ID | state |
121           | 0  | Florida |
122         When sending json search query "25 de Mayo" with address
123           | accept-language | viewbox |
124           | en              | -57.95468,-31.39261,-57.94741,-31.39490 |
125         Then result addresses contain
126           | ID | state |
127           | 0  | Salto |
128
129     Scenario: viewboxes cannot be points
130         When sending json search query "foo"
131           | viewbox |
132           | 1.01,34.6,1.01,34.6 |
133         Then a HTTP 400 is returned
134
135     Scenario Outline: viewbox must have four coordinate numbers
136         When sending json search query "foo"
137           | viewbox |
138           | <viewbox> |
139         Then a HTTP 400 is returned
140
141     Examples:
142         | viewbox |
143         | 34      |
144         | 0.003,-84.4 |
145         | 5.2,4.5542,12.4 |
146         | 23.1,-6,0.11,44.2,9.1 |
147
148     Scenario Outline: viewboxlbrt must have four coordinate numbers
149         When sending json search query "foo"
150           | viewboxlbrt |
151           | <viewbox> |
152         Then a HTTP 400 is returned
153
154     Examples:
155         | viewbox |
156         | 34      |
157         | 0.003,-84.4 |
158         | 5.2,4.5542,12.4 |
159         | 23.1,-6,0.11,44.2,9.1 |
160
161     Scenario: Overly large limit number for search results
162         When sending json search query "restaurant"
163           | limit |
164           | 1000 |
165         Then at most 50 results are returned
166
167     Scenario: Limit number of search results
168         When sending json search query "restaurant"
169           | limit |
170           | 4 |
171         Then exactly 4 results are returned
172
173     Scenario: Limit parameter must be a number
174         When sending search query "Blue Laguna"
175           | limit |
176           | );    |
177         Then a HTTP 400 is returned
178
179     Scenario: Restrict to feature type country
180         When sending xml search query "Uruguay"
181         Then results contain
182           | ID | place_rank |
183           | 1  | 16 |
184         When sending xml search query "Uruguay"
185           | featureType |
186           | country |
187         Then results contain
188           | place_rank |
189           | 4 |
190
191     Scenario: Restrict to feature type state
192         When sending xml search query "Dakota"
193         Then results contain
194           | place_rank |
195           | 12 |
196         When sending xml search query "Dakota"
197           | featureType |
198           | state |
199         Then results contain
200           | place_rank |
201           | 8 |
202
203     Scenario: Restrict to feature type city
204         When sending xml search query "vaduz"
205         Then results contain
206           | ID | place_rank |
207           | 1  | 30 |
208         When sending xml search query "vaduz"
209           | featureType |
210           | city |
211         Then results contain
212           | place_rank |
213           | 16 |
214
215     Scenario: Restrict to feature type settlement
216         When sending json search query "Burg"
217         Then results contain
218           | ID | class |
219           | 1  | amenity |
220         When sending json search query "Burg"
221           | featureType |
222           | settlement |
223         Then results contain
224           | class    | type |
225           | boundary | administrative | 
226
227     Scenario Outline: Search with polygon threshold (json)
228         When sending json search query "switzerland"
229           | polygon_geojson | polygon_threshold |
230           | 1               | <th> |
231         Then at least 1 result is returned
232         And result 0 has attributes geojson
233
234      Examples:
235         | th |
236         | -1 |
237         | 0.0 |
238         | 0.5 |
239         | 999 |
240
241     Scenario Outline: Search with polygon threshold (xml)
242         When sending xml search query "switzerland"
243           | polygon_geojson | polygon_threshold |
244           | 1               | <th> |
245         Then at least 1 result is returned
246         And result 0 has attributes geojson
247
248      Examples:
249         | th |
250         | -1 |
251         | 0.0 |
252         | 0.5 |
253         | 999 |
254
255     Scenario Outline: Search with invalid polygon threshold (xml)
256         When sending xml search query "switzerland"
257           | polygon_geojson | polygon_threshold |
258           | 1               | <th> |
259         Then a HTTP 400 is returned
260
261      Examples:
262         | th |
263         | x |
264         | ;; |
265         | 1m |
266
267     Scenario Outline: Search with extratags
268         When sending <format> search query "Hauptstr"
269           | extratags |
270           | 1 |
271         Then result has attributes extratags
272
273     Examples:
274         | format |
275         | xml |
276         | json |
277         | jsonv2 |
278         | geojson |
279
280     Scenario Outline: Search with namedetails
281         When sending <format> search query "Hauptstr"
282           | namedetails |
283           | 1 |
284         Then result has attributes namedetails
285
286     Examples:
287         | format |
288         | xml |
289         | json |
290         | jsonv2 |
291         | geojson |
292
293     Scenario Outline: Search result with contains TEXT geometry
294         When sending <format> search query "Highmore"
295           | polygon_text |
296           | 1 |
297         Then result has attributes <response_attribute>
298
299     Examples:
300         | format   | response_attribute |
301         | xml      | geotext |
302         | json     | geotext |
303         | jsonv2   | geotext |
304
305     Scenario Outline: Search result contains SVG geometry
306         When sending <format> search query "Highmore"
307           | polygon_svg |
308           | 1 |
309         Then result has attributes <response_attribute>
310
311     Examples:
312         | format   | response_attribute |
313         | xml      | geosvg |
314         | json     | svg |
315         | jsonv2   | svg |
316
317     Scenario Outline: Search result contains KML geometry
318         When sending <format> search query "Highmore"
319           | polygon_kml |
320           | 1 |
321         Then result has attributes <response_attribute>
322
323     Examples:
324         | format   | response_attribute |
325         | xml      | geokml |
326         | json     | geokml |
327         | jsonv2   | geokml |
328
329     Scenario Outline: Search result contains GEOJSON geometry
330         When sending <format> search query "Highmore"
331           | polygon_geojson |
332           | 1 |
333         Then result has attributes <response_attribute>
334
335     Examples:
336         | format   | response_attribute |
337         | xml      | geojson |
338         | json     | geojson |
339         | jsonv2   | geojson |
340         | geojson  | geojson |
341
342     Scenario Outline: Search result in geojson format contains no non-geojson geometry
343         When sending geojson search query "Highmore"
344           | polygon_text | polygon_svg | polygon_geokml |
345           | 1            | 1           | 1              |
346         Then result 0 has not attributes <response_attribute>
347
348     Examples:
349         | response_attribute |
350         | geotext            |
351         | polygonpoints      |
352         | svg                |
353         | geokml             |
354
355     Scenario: Search along a route
356         When sending json search query "restaurant" with address
357           | bounded | routewidth | route                                   |
358           | 1       | 0.1        | -103.23255,44.08198,-103.22516,44.08079 |
359         Then result addresses contain
360           | city |
361           | Rapid City |
362
363