]> git.openstreetmap.org Git - nominatim.git/blob - test/bdd/api/search/params.feature
d1cff1cc5d63818909b751d381fcc2c8e9254298
[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,icon
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,icon,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: JSON search with addressdetails
23         When sending json search query "Montevideo" with address
24         Then address of result 0 is
25           | type         | value |
26           | city         | Montevideo |
27           | state        | Montevideo |
28           | country      | Uruguay |
29           | country_code | uy |
30
31     Scenario: XML search with addressdetails
32         When sending xml search query "Aleg" with address
33           | accept-language |
34           | en |
35         Then address of result 0 is
36           | type         | value |
37           | city         | Aleg |
38           | state        | Brakna |
39           | country      | Mauritania |
40           | country_code | mr |
41
42     Scenario: coordinate search with addressdetails
43         When sending json search query "14.271104294939,107.69828796387"
44           | accept-language |
45           | en |
46         Then results contain
47           | display_name |
48           | Plei Ya RĂȘ, Kon Tum province, Vietnam |
49
50     Scenario: Address details with unknown class types
51         When sending json search query "Hundeauslauf, Hamburg" with address
52         Then results contain
53           | ID | class   | type |
54           | 0  | leisure | dog_park |
55         And result addresses contain
56           | ID | address29 |
57           | 0  | Hundeauslauf |
58         And address of result 0 has no types leisure,dog_park
59
60     Scenario: Disabling deduplication
61         When sending json search query "Sievekingsallee, Hamburg"
62         Then there are no duplicates
63         When sending json search query "Sievekingsallee, Hamburg"
64           | dedupe |
65           | 0 |
66         Then there are duplicates
67
68     Scenario: Search with bounded viewbox in right area
69         When sending json search query "restaurant" with address
70           | bounded | viewbox |
71           | 1       | -56.16786,-34.84061,-56.12525,-34.86526 |
72         Then result addresses contain
73           | city |
74           | Montevideo |
75
76     Scenario: Search with bounded viewboxlbrt in right area
77         When sending json search query "restaurant" with address
78           | bounded | viewboxlbrt |
79           | 1       | -56.16786,-34.86526,-56.12525,-34.84061 |
80         Then result addresses contain
81           | city |
82           | Montevideo |
83
84     Scenario: No POI search with unbounded viewbox
85         When sending json search query "restaurant"
86           | viewbox |
87           | 9.93027,53.61634,10.10073,53.54500 |
88         Then results contain
89           | display_name |
90           | ^[^,]*[Rr]estaurant.* |
91
92     Scenario: bounded search remains within viewbox, even with no results
93          When sending json search query "restaurant"
94            | bounded | viewbox |
95            | 1       | 43.5403125,-5.6563282,43.54285,-5.662003 |
96         Then less than 1 result is returned
97
98     Scenario: bounded search remains within viewbox with results
99         When sending json search query "restaurant"
100          | bounded | viewbox |
101          | 1       | 9.93027,53.61634,10.10073,53.54500 |
102         Then result has bounding box in 53.54500,53.61634,9.93027,10.10073
103
104     Scenario: Prefer results within viewbox
105         When sending json search query "25 de Mayo" with address
106           | accept-language |
107           | en |
108         Then result addresses contain
109           | ID | state |
110           | 0  | Salto |
111         When sending json search query "25 de Mayo" with address
112           | accept-language | viewbox |
113           | en              | -56.35879,-34.18330,-56.31618,-34.20815 |
114         Then result addresses contain
115           | ID | state |
116           | 0  | Florida |
117
118     Scenario: Overly large limit number for search results
119         When sending json search query "restaurant"
120           | limit |
121           | 1000 |
122         Then at most 50 results are returned
123
124     Scenario: Limit number of search results
125         When sending json search query "restaurant"
126           | limit |
127           | 4 |
128         Then exactly 4 results are returned
129
130     Scenario: Restrict to feature type country
131         When sending xml search query "Uruguay"
132         Then results contain
133           | ID | place_rank |
134           | 1  | 16 |
135         When sending xml search query "Uruguay"
136           | featureType |
137           | country |
138         Then results contain
139           | place_rank |
140           | 4 |
141
142     Scenario: Restrict to feature type state
143         When sending xml search query "Dakota"
144         Then results contain
145           | place_rank |
146           | 12 |
147         When sending xml search query "Dakota"
148           | featureType |
149           | state |
150         Then results contain
151           | place_rank |
152           | 8 |
153
154     Scenario: Restrict to feature type city
155         When sending xml search query "vaduz"
156         Then results contain
157           | ID | place_rank |
158           | 1  | 30 |
159         When sending xml search query "vaduz"
160           | featureType |
161           | city |
162         Then results contain
163           | place_rank |
164           | 16 |
165
166     Scenario: Restrict to feature type settlement
167         When sending json search query "Burg"
168         Then results contain
169           | ID | class |
170           | 1  | amenity |
171         When sending json search query "Burg"
172           | featureType |
173           | settlement |
174         Then results contain
175           | class    | type |
176           | boundary | administrative | 
177
178     Scenario Outline: Search with polygon threshold (json)
179         When sending json search query "switzerland"
180           | polygon_geojson | polygon_threshold |
181           | 1               | <th> |
182         Then at least 1 result is returned
183         And result 0 has attributes geojson
184
185      Examples:
186         | th |
187         | -1 |
188         | 0.0 |
189         | 0.5 |
190         | 999 |
191
192     Scenario Outline: Search with polygon threshold (xml)
193         When sending xml search query "switzerland"
194           | polygon_geojson | polygon_threshold |
195           | 1               | <th> |
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         When sending xml search query "switzerland"
208           | polygon_geojson | polygon_threshold |
209           | 1               | <th> |
210         Then a HTTP 400 is returned
211
212      Examples:
213         | th |
214         | x |
215         | ;; |
216         | 1m |
217
218     Scenario Outline: Search with extratags
219         When sending <format> search query "Hauptstr"
220           | extratags |
221           | 1 |
222         Then result has attributes extratags
223
224     Examples:
225         | format |
226         | xml |
227         | json |
228         | jsonv2 |
229
230     Scenario Outline: Search with namedetails
231         When sending <format> search query "Hauptstr"
232           | namedetails |
233           | 1 |
234         Then result has attributes namedetails
235
236     Examples:
237         | format |
238         | xml |
239         | json |
240         | jsonv2 |
241
242     Scenario Outline: Search result with contains TEXT geometry
243         When sending <format> search query "Highmore"
244           | polygon_text |
245           | 1 |
246         Then result has attributes <response_attribute>
247
248     Examples:
249         | format   | response_attribute |
250         | xml      | geotext |
251         | json     | geotext |
252         | jsonv2   | geotext |
253
254     Scenario Outline: Search result contains polygon-as-points geometry
255         When sending <format> search query "Highmore"
256           | polygon |
257           | 1 |
258         Then result has attributes <response_attribute>
259
260     Examples:
261         | format   | response_attribute |
262         | xml      | polygonpoints |
263         | json     | polygonpoints |
264         | jsonv2   | polygonpoints |
265
266     Scenario Outline: Search result contains SVG geometry
267         When sending <format> search query "Highmore"
268           | polygon_svg |
269           | 1 |
270         Then result has attributes <response_attribute>
271
272     Examples:
273         | format   | response_attribute |
274         | xml      | geosvg |
275         | json     | svg |
276         | jsonv2   | svg |
277
278     Scenario Outline: Search result contains KML geometry
279         When sending <format> search query "Highmore"
280           | polygon_kml |
281           | 1 |
282         Then result has attributes <response_attribute>
283
284     Examples:
285         | format   | response_attribute |
286         | xml      | geokml |
287         | json     | geokml |
288         | jsonv2   | geokml |
289
290     Scenario Outline: Search result contains GEOJSON geometry
291         When sending <format> search query "Highmore"
292           | polygon_geojson |
293           | 1 |
294         Then result has attributes <response_attribute>
295
296     Examples:
297         | format   | response_attribute |
298         | xml      | geojson |
299         | json     | geojson |
300         | jsonv2   | geojson |