]> git.openstreetmap.org Git - nominatim.git/blob - tests/features/api/search_params.feature
Merge remote-tracking branch 'upstream/master'
[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.5403125,-5.6563282,43.54285,-5.662003
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         | nan
191
192     Scenario Outline: Search with polygon threshold (xml)
193         Given the request parameters
194           | polygon_geojson | polygon_threshold
195           | 1               | <th>
196         When sending xml search query "switzerland"
197         Then at least 1 result is returned
198         And result 0 has attributes geojson
199
200      Examples:
201         | th
202         | -1
203         | 0.0
204         | 0.5
205         | 999
206         | nan
207
208     Scenario Outline: Search with extratags
209         Given the request parameters
210           | extratags
211           | 1
212         When sending <format> search query "Hauptstr"
213         Then result 0 has attributes extratags
214         And result 1 has attributes extratags
215
216     Examples:
217         | format
218         | xml
219         | json
220         | jsonv2
221
222     Scenario Outline: Search with namedetails
223         Given the request parameters
224           | namedetails
225           | 1
226         When sending <format> search query "Hauptstr"
227         Then result 0 has attributes namedetails
228         And result 1 has attributes namedetails
229
230     Examples:
231         | format
232         | xml
233         | json
234         | jsonv2
235
236
237    Scenario Outline: Search result with contains TEXT geometry
238         Given the request parameters
239           | polygon_text
240           | 1
241         When sending <format> search query "switzerland"
242         Then result 0 has attributes <response_attribute>
243
244    Examples:
245         | format   | response_attribute
246         | xml      | geotext
247         | json     | geotext
248         | jsonv2   | geotext
249
250    Scenario Outline: Search result contains polygon-as-points geometry
251         Given the request parameters
252           | polygon
253           | 1
254         When sending <format> search query "switzerland"
255         Then result 0 has attributes <response_attribute>
256
257    Examples:
258         | format   | response_attribute
259         | xml      | polygonpoints
260         | json     | polygonpoints
261         | jsonv2   | polygonpoints
262
263
264
265    Scenario Outline: Search result contains SVG geometry
266         Given the request parameters
267           | polygon_svg
268           | 1
269         When sending <format> search query "switzerland"
270         Then result 0 has attributes <response_attribute>
271
272    Examples:
273         | format   | response_attribute
274         | xml      | geosvg
275         | json     | svg
276         | jsonv2   | svg
277
278
279    Scenario Outline: Search result contains KML geometry
280         Given the request parameters
281           | polygon_kml
282           | 1
283         When sending <format> search query "switzerland"
284         Then result 0 has attributes <response_attribute>
285
286    Examples:
287         | format   | response_attribute
288         | xml      | geokml
289         | json     | geokml
290         | jsonv2   | geokml
291
292
293    Scenario Outline: Search result contains GEOJSON geometry
294         Given the request parameters
295           | polygon_geojson
296           | 1
297         When sending <format> search query "switzerland"
298         Then result 0 has attributes <response_attribute>
299
300    Examples:
301         | format   | response_attribute
302         | xml      | geojson
303         | json     | geojson
304         | jsonv2   | geojson