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