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