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