]> git.openstreetmap.org Git - nominatim.git/blob - tests/features/api/search_params.feature
add functional 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
12     Scenario: Simple JSON search
13         When sending json search query "Vaduz"
14         And result 0 has attributes place_id,licence,icon,class,type
15         And result 0 has attributes osm_type,osm_id,boundingbox
16         And result 0 has attributes lat,lon,display_name,importance
17         And result 0 has not attributes address
18
19     Scenario: JSON search with addressdetails
20         When sending json search query "Montevideo" with address
21         Then address of result 0 is
22           | type         | value
23           | city         | Montevideo
24           | state        | Montevideo
25           | country      | Uruguay
26           | country_code | uy
27
28     Scenario: XML search with addressdetails
29         When sending xml search query "Inuvik" with address
30         Then address of result 0 is
31           | type         | value
32           | town         | Inuvik
33           | state        | Northwest Territories
34           | country      | Canada
35           | country_code | ca
36
37     Scenario: Address details with unknown class types
38         When sending json search query "foobar, Essen" with address
39         Then results contain
40           | ID | class   | type
41           | 0  | leisure | hackerspace
42         And result addresses contain
43           | ID | address29
44           | 0  | foobar
45         And address of result 0 does not contain leisure,hackerspace
46
47     Scenario: Disabling deduplication
48         When sending json search query "Oxford Street, London"
49         Then there are no duplicates
50         Given the request parameters
51           | dedupe
52           | 0
53         When sending json search query "Oxford Street, London"
54         Then there are duplicates
55
56     Scenario: Search with bounded viewbox in right area
57         Given the request parameters
58           | bounded | viewbox
59           | 1       | -87.7,41.9,-87.57,41.85
60         When sending json search query "restaurant" with address
61         Then result addresses contain
62           | ID | city
63           | 0  | Chicago
64
65     Scenario: Search with bounded viewboxlbrt in right area
66         Given the request parameters
67           | bounded | viewboxlbrt
68           | 1       | -87.7,41.85,-87.57,41.9
69         When sending json search query "restaurant" with address
70         Then result addresses contain
71           | ID | city
72           | 0  | Chicago
73     
74     Scenario: No POI search with unbounded viewbox
75         Given the request parameters
76           | viewbox
77           | -87.7,41.9,-87.57,41.85
78         When sending json search query "restaurant"
79         Then results contain
80           | display_name
81           | [^,]*(?i)restaurant.*
82
83     Scenario: bounded search remains within viewbox, even with no results
84         Given the request parameters
85          | bounded | viewbox
86          | 1       | -5.662003,43.54285,-5.6563282,43.5403125
87          When sending json search query "restaurant"
88         Then less than 1 result is returned
89
90     Scenario: bounded search remains within viewbox with results
91         Given the request parameters
92          | bounded | viewbox
93          | 1       | -5.662003,43.55,-5.6563282,43.5403125
94         When sending json search query "restaurant"
95          | lon          | lat
96          | >= -5.662003 | >= 43.5403125
97          | <= -5.6563282| <= 43.55
98
99     Scenario: Prefer results within viewbox
100         Given the request parameters
101           | accept-language
102           | en
103         When sending json search query "royan" with address
104         Then result addresses contain
105           | ID | country
106           | 0  | France
107         Given the request parameters
108           | accept-language | viewbox
109           | en              | 51.94,36.59,51.99,36.56
110         When sending json search query "royan" with address
111         Then result addresses contain
112           | ID | country
113           | 0  | Iran
114
115     Scenario: Overly large limit number for search results
116         Given the request parameters
117           | limit
118           | 1000
119         When sending json search query "Neustadt"
120         Then at most 50 results are returned
121
122     Scenario: Limit number of search results
123         Given the request parameters
124           | limit
125           | 4
126         When sending json search query "Neustadt"
127         Then exactly 4 results are returned
128
129     Scenario: Restrict to feature type country
130         Given the request parameters
131           | featureType
132           | country
133         When sending xml search query "Monaco"
134         Then results contain
135           | place_rank
136           | 4
137
138     Scenario: Restrict to feature type state
139         When sending xml search query "Berlin"
140         Then results contain
141           | ID | place_rank
142           | 0  | 1[56]
143         Given the request parameters
144           | featureType
145           | state
146         When sending xml search query "Berlin"
147         Then results contain
148           | place_rank
149           | [78]
150
151     Scenario: Restrict to feature type city
152         Given the request parameters
153           | featureType
154           | city
155         When sending xml search query "Monaco"
156         Then results contain
157           | place_rank
158           | 1[56789]
159
160
161     Scenario: Restrict to feature type settlement
162         When sending json search query "Everest"
163         Then results contain
164           | ID | display_name
165           | 0  | Mount Everest.*
166         Given the request parameters
167           | featureType
168           | settlement
169         When sending json search query "Everest"
170         Then results contain
171           | ID | display_name
172           | 0  | Everest.*