]> git.openstreetmap.org Git - nominatim.git/blob - tests/features/api/search_params.feature
fix syntax errors and update tests
[nominatim.git] / tests / features / api / search_params.feature
1 Feature: Search queries
2     Testing different queries and parameters
3
4     Scenario: Simple XML search
5         When sending xml search query "Schaan"
6         Then result 0 has attributes place_id,osm_type,osm_id
7         And result 0 has attributes place_rank,boundingbox
8         And result 0 has attributes lat,lon,display_name
9         And result 0 has attributes class,type,importance,icon
10         And result 0 has not attributes address
11         And results contain valid boundingboxes
12
13     Scenario: Simple JSON search
14         When sending json search query "Vaduz"
15         And result 0 has attributes place_id,licence,icon,class,type
16         And result 0 has attributes osm_type,osm_id,boundingbox
17         And result 0 has attributes lat,lon,display_name,importance
18         And result 0 has not attributes address
19         And results contain valid boundingboxes
20
21     Scenario: JSON search with addressdetails
22         When sending json search query "Montevideo" with address
23         Then address of result 0 is
24           | type         | value
25           | city         | Montevideo
26           | state        | Montevideo
27           | country      | Uruguay
28           | country_code | uy
29
30     Scenario: XML search with addressdetails
31         When sending xml search query "Inuvik" with address
32         Then address of result 0 contains
33           | type         | value
34           | city         | Inuvik
35           | state        | Northwest Territories
36           | country      | Canada
37           | country_code | ca
38
39     Scenario: Address details with unknown class types
40         When sending json search query "foobar, Essen" with address
41         Then results contain
42           | ID | class   | type
43           | 0  | leisure | hackerspace
44         And result addresses contain
45           | ID | address29
46           | 0  | Chaospott
47         And address of result 0 does not contain leisure,hackerspace
48
49     Scenario: Disabling deduplication
50         When sending json search query "Oxford Street, London"
51         Then there are no duplicates
52         Given the request parameters
53           | dedupe
54           | 0
55         When sending json search query "Oxford Street, London"
56         Then there are duplicates
57
58     Scenario: Search with bounded viewbox in right area
59         Given the request parameters
60           | bounded | viewbox
61           | 1       | -87.7,41.9,-87.57,41.85
62         When sending json search query "restaurant" with address
63         Then result addresses contain
64           | ID | city
65           | 0  | Chicago
66
67     Scenario: Search with bounded viewboxlbrt in right area
68         Given the request parameters
69           | bounded | viewboxlbrt
70           | 1       | -87.7,41.85,-87.57,41.9
71         When sending json search query "restaurant" with address
72         Then result addresses contain
73           | ID | city
74           | 0  | Chicago
75
76     Scenario: No POI search with unbounded viewbox
77         Given the request parameters
78           | viewbox
79           | -87.7,41.9,-87.57,41.85
80         When sending json search query "restaurant"
81         Then results contain
82           | display_name
83           | [^,]*(?i)restaurant.*
84
85     Scenario: bounded search remains within viewbox, even with no results
86         Given the request parameters
87          | bounded | viewbox
88          | 1       | 43.54285,-5.662003,43.5403125,-5.6563282
89          When sending json search query "restaurant"
90         Then less than 1 result is returned
91
92     Scenario: bounded search remains within viewbox with results
93         Given the request parameters
94          | bounded | viewbox
95          | 1       | -5.662003,43.55,-5.6563282,43.5403125
96         When sending json search query "restaurant"
97          | lon          | lat
98          | >= -5.662003 | >= 43.5403125
99          | <= -5.6563282| <= 43.55
100
101     Scenario: Prefer results within viewbox
102         Given the request parameters
103           | accept-language
104           | en
105         When sending json search query "royan" with address
106         Then result addresses contain
107           | ID | country
108           | 0  | France
109         Given the request parameters
110           | accept-language | viewbox
111           | en              | 51.94,36.59,51.99,36.56
112         When sending json search query "royan" with address
113         Then result addresses contain
114           | ID | country
115           | 0  | Iran
116
117     Scenario: Overly large limit number for search results
118         Given the request parameters
119           | limit
120           | 1000
121         When sending json search query "Neustadt"
122         Then at most 50 results are returned
123
124     Scenario: Limit number of search results
125         Given the request parameters
126           | limit
127           | 4
128         When sending json search query "Neustadt"
129         Then exactly 4 results are returned
130
131     Scenario: Restrict to feature type country
132         Given the request parameters
133           | featureType
134           | country
135         When sending xml search query "Monaco"
136         Then results contain
137           | place_rank
138           | 4
139
140     Scenario: Restrict to feature type state
141         When sending xml search query "Berlin"
142         Then results contain
143           | ID | place_rank
144           | 0  | 1[56]
145         Given the request parameters
146           | featureType
147           | state
148         When sending xml search query "Berlin"
149         Then results contain
150           | place_rank
151           | [78]
152
153     Scenario: Restrict to feature type city
154         Given the request parameters
155           | featureType
156           | city
157         When sending xml search query "Monaco"
158         Then results contain
159           | place_rank
160           | 1[56789]
161
162
163     Scenario: Restrict to feature type settlement
164         When sending json search query "Everest"
165         Then results contain
166           | ID | display_name
167           | 0  | Mount Everest.*
168         Given the request parameters
169           | featureType
170           | settlement
171         When sending json search query "Everest"
172         Then results contain
173           | ID | display_name
174           | 0  | Everest.*
175
176     Scenario Outline: Search with polygon threshold (json)
177         Given the request parameters
178           | polygon_geojson | polygon_threshold
179           | 1               | <th>
180         When sending json search query "switzerland"
181         Then at least 1 result is returned
182         And result 0 has attributes geojson
183
184      Examples:
185         | th
186         | -1
187         | 0.0
188         | 0.5
189         | 999
190
191     Scenario Outline: Search with polygon threshold (xml)
192         Given the request parameters
193           | polygon_geojson | polygon_threshold
194           | 1               | <th>
195         When sending xml search query "switzerland"
196         Then at least 1 result is returned
197         And result 0 has attributes geojson
198
199      Examples:
200         | th
201         | -1
202         | 0.0
203         | 0.5
204         | 999
205
206     Scenario Outline: Search with invalid polygon threshold (xml)
207         Given the request parameters
208           | polygon_geojson | polygon_threshold
209           | 1               | <th>
210         When sending xml search query "switzerland"
211         Then a HTTP 400 is returned
212
213
214     Scenario Outline: Search with extratags
215         Given the request parameters
216           | extratags
217           | 1
218         When sending <format> search query "Hauptstr"
219         Then result 0 has attributes extratags
220         And result 1 has attributes extratags
221
222     Examples:
223         | format
224         | xml
225         | json
226         | jsonv2
227
228     Scenario Outline: Search with namedetails
229         Given the request parameters
230           | namedetails
231           | 1
232         When sending <format> search query "Hauptstr"
233         Then result 0 has attributes namedetails
234         And result 1 has attributes namedetails
235
236     Examples:
237         | format
238         | xml
239         | json
240         | jsonv2
241
242
243    Scenario Outline: Search result with contains TEXT geometry
244         Given the request parameters
245           | polygon_text
246           | 1
247         When sending <format> search query "switzerland"
248         Then result 0 has attributes <response_attribute>
249
250    Examples:
251         | format   | response_attribute
252         | xml      | geotext
253         | json     | geotext
254         | jsonv2   | geotext
255
256    Scenario Outline: Search result contains polygon-as-points geometry
257         Given the request parameters
258           | polygon
259           | 1
260         When sending <format> search query "switzerland"
261         Then result 0 has attributes <response_attribute>
262
263    Examples:
264         | format   | response_attribute
265         | xml      | polygonpoints
266         | json     | polygonpoints
267         | jsonv2   | polygonpoints
268
269
270
271    Scenario Outline: Search result contains SVG geometry
272         Given the request parameters
273           | polygon_svg
274           | 1
275         When sending <format> search query "switzerland"
276         Then result 0 has attributes <response_attribute>
277
278    Examples:
279         | format   | response_attribute
280         | xml      | geosvg
281         | json     | svg
282         | jsonv2   | svg
283
284
285    Scenario Outline: Search result contains KML geometry
286         Given the request parameters
287           | polygon_kml
288           | 1
289         When sending <format> search query "switzerland"
290         Then result 0 has attributes <response_attribute>
291
292    Examples:
293         | format   | response_attribute
294         | xml      | geokml
295         | json     | geokml
296         | jsonv2   | geokml
297
298
299    Scenario Outline: Search result contains GEOJSON geometry
300         Given the request parameters
301           | polygon_geojson
302           | 1
303         When sending <format> search query "switzerland"
304         Then result 0 has attributes <response_attribute>
305
306    Examples:
307         | format   | response_attribute
308         | xml      | geojson
309         | json     | geojson
310         | jsonv2   | geojson