]> git.openstreetmap.org Git - nominatim.git/blob - test/bdd/api/search/queries.feature
Merge remote-tracking branch 'upstream/master' into collect_os_info.sh
[nominatim.git] / test / bdd / api / search / queries.feature
1 @APIDB
2 Feature: Search queries
3     Generic search result correctness
4
5     Scenario: House number search for non-street address
6         When sending json search query "6 Silum, Liechtenstein" with address
7           | accept-language |
8           | en |
9         Then address of result 0 is
10           | type         | value |
11           | house_number | 6 |
12           | village      | Silum |
13           | town         | Triesenberg |
14           | county       | Oberland |
15           | postcode     | 9497 |
16           | country      | Liechtenstein |
17           | country_code | li |
18           | ISO3166-2-lvl8  | LI-10 |
19
20     Scenario: House number interpolation
21         When sending json search query "Grosssteg 1023, Triesenberg" with address
22           | accept-language |
23           | de |
24         Then address of result 0 contains
25           | type          | value |
26           | house_number  | 1023 |
27           | road          | Grosssteg |
28           | village       | Sücka |
29           | postcode      | 9497 |
30           | town          | Triesenberg |
31           | country       | Liechtenstein |
32           | country_code  | li |
33
34     Scenario: With missing housenumber search falls back to road
35         When sending json search query "Bündaweg 555" with address
36         Then address of result 0 is
37           | type          | value |
38           | road          | Bündaweg |
39           | village       | Silum |
40           | postcode      | 9497 |
41           | county        | Oberland |
42           | town          | Triesenberg |
43           | country       | Liechtenstein |
44           | country_code  | li |
45           | ISO3166-2-lvl8  | LI-10 |
46
47     Scenario Outline: Housenumber 0 can be found
48         When sending <format> search query "Gnalpstrasse 0" with address
49         Then results contain
50           | display_name |
51           | ^0,.* |
52         And result addresses contain
53           | house_number |
54           | 0     |
55
56     Examples:
57         | format |
58         | xml |
59         | json |
60         | jsonv2 |
61         | geojson |
62
63     @Tiger
64     Scenario: TIGER house number
65         When sending json search query "697 Upper Kingston Road"
66         Then results contain
67          | osm_type | display_name |
68          | way      | ^697,.* |
69
70     Scenario: Search with class-type feature
71         When sending jsonv2 search query "bars in ebenholz"
72         Then results contain
73           | place_rank |
74           | 30 |
75
76     Scenario: Search with specific amenity
77         When sending json search query "[restaurant] Vaduz" with address
78         Then result addresses contain
79           | country |
80           | Liechtenstein |
81         And  results contain
82           | class   | type |
83           | amenity | restaurant |
84
85     Scenario: Search with specific amenity also work in country
86         When sending json search query "restaurants in liechtenstein" with address
87         Then result addresses contain
88           | country |
89           | Liechtenstein |
90         And  results contain
91           | class   | type |
92           | amenity | restaurant |
93
94     Scenario: Search with key-value amenity
95         When sending json search query "[club=scout] Vaduz"
96         Then results contain
97           | class | type |
98           | club  | scout |
99
100     Scenario: With multiple amenity search only the first is used
101         When sending json search query "[club=scout] [church] vaduz"
102         Then results contain
103           | class | type |
104           | club  | scout |
105         When sending json search query "[amenity=place_of_worship] [club=scout] vaduz"
106         Then results contain
107           | class   | type |
108           | amenity | place_of_worship |
109
110     Scenario: POI search near given coordinate
111         When sending json search query "restaurant near 47.16712,9.51100"
112         Then results contain
113           | class   | type |
114           | amenity | restaurant |
115
116     Scenario: Arbitrary key/value search near given coordinate
117         When sending json search query "[leisure=firepit]   47.150° N 9.5340493° E"
118         Then results contain
119           | class   | type |
120           | leisure | firepit |
121
122     Scenario: Arbitrary key/value search near given coordinate and named place
123         When sending json search query "[leisure=firepit] ebenholz  47° 9′ 26″ N 9° 36′ 45″ E"
124         Then results contain
125           | class    | type |
126           | leisure | firepit |
127
128     Scenario Outline: Key/value search near given coordinate can be restricted to country
129         When sending json search query "[natural=peak] 47.06512,9.53965" with address
130           | countrycodes |
131           | <cc> |
132         Then result addresses contain
133           | country_code |
134           | <cc> |
135
136     Examples:
137         | cc |
138         | li |
139         | ch |
140
141     Scenario: Name search near given coordinate
142         When sending json search query "sporry" with address
143         Then result addresses contain
144           | ID | town |
145           | 0  | Vaduz |
146         When sending json search query "sporry, 47.10791,9.52676" with address
147         Then result addresses contain
148           | ID | village |
149           | 0  | Triesen |
150
151     Scenario: Name search near given coordinate without result
152         When sending json search query "sporry, N 47 15 7 W 9 61 26"
153         Then exactly 0 results are returned
154
155     Scenario: Arbitrary key/value search near a road
156         When sending json search query "[amenity=drinking_water] Wissfläckaweg"
157         Then results contain
158           | class   | type |
159           | amenity | drinking_water |
160
161     Scenario: Ignore other country codes in structured search with country
162         When sending json search query ""
163             | city | country |
164             | li   | de      |
165         Then exactly 0 results are returned
166
167     Scenario: Ignore country searches when query is restricted to countries
168         When sending json search query "fr"
169             | countrycodes |
170             | li  |
171         Then exactly 0 results are returned
172
173     Scenario: Country searches only return results for the given country
174         When sending search query "Ans Trail" with address
175             | countrycodes |
176             | li |
177         Then result addresses contain
178             | country_code |
179             | li |
180
181     # https://trac.openstreetmap.org/ticket/5094
182     Scenario: housenumbers are ordered by complete match first
183         When sending json search query "Austrasse 11, Vaduz" with address
184         Then result addresses contain
185           | ID | house_number |
186           | 0  | 11 |
187           | 1  | 11 a |
188
189     Scenario Outline: Coordinate searches with white spaces
190         When sending json search query "<data>"
191         Then exactly 1 result is returned
192         And results contain
193           | class   |
194           | natural |
195
196     Examples:
197       | data |
198       | sporry weiher, N 47.10791° E 9.52676° |
199       | sporry weiher,  N 47.10791° E 9.52676° |
200       |         sporry weiher   ,       N 47.10791° E 9.52676° |
201       | sporry weiher, N 47.10791°             E 9.52676° |
202       | sporry weiher\v, N 47.10791° E  9.52676° |
203
204     Scenario: Searches with white spaces
205         When sending json search query "52      Bodastr\v,\fTriesenberg"
206         Then results contain
207           | class   | type |
208           | highway | residential |
209
210
211     # github #1949
212     Scenario: Addressdetails always return the place type
213        When sending json search query "Vaduz" with address
214        Then result addresses contain
215          | ID | town |
216          | 0  | Vaduz |
217
218     Scenario: Search can handle complex query word sets
219        When sending search query "aussenstelle universitat lichtenstein wachterhaus aussenstelle universitat lichtenstein wachterhaus aussenstelle universitat lichtenstein wachterhaus aussenstelle universitat lichtenstein wachterhaus"
220        Then a HTTP 200 is returned