]> git.openstreetmap.org Git - nominatim.git/blob - test/bdd/api/search/queries.feature
Merge pull request #1733 from krahulreddy/whitespaces-considered-as-single-space
[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 "2 Steinwald, Austria" with address
7           | accept-language |
8           | en |
9         Then address of result 0 is
10           | type         | value |
11           | house_number | 2 |
12           | hamlet       | Steinwald |
13           | village      | Göfis |
14           | postcode     | 6811 |
15           | country      | Austria |
16           | country_code | at |
17
18     Scenario: House number interpolation even
19         When sending json search query "Schellingstr 86, Hamburg" with address
20           | accept-language |
21           | de |
22         Then address of result 0 is
23           | type          | value |
24           | house_number  | 86 |
25           | road          | Schellingstraße |
26           | neighbourhood | Auenviertel |
27           | suburb        | Eilbek |
28           | postcode      | 22089 |
29           | city          | Hamburg |
30           | country       | Deutschland |
31           | country_code  | de |
32
33     Scenario: House number interpolation odd
34         When sending json search query "Schellingstr 73, Hamburg" with address
35           | accept-language |
36           | de |
37         Then address of result 0 is
38           | type          | value |
39           | house_number  | 73 |
40           | road          | Schellingstraße |
41           | neighbourhood | Auenviertel |
42           | suburb        | Eilbek |
43           | postcode      | 22089 |
44           | city          | Hamburg |
45           | country       | Deutschland |
46           | country_code  | de |
47
48     Scenario: With missing housenumber search falls back to road
49         When sending json search query "342 rocha, santa lucia" with address
50         Then address of result 0 is
51           | type         | value |
52           | road         | Rocha |
53           | city         | Santa Lucía |
54           | state        | Canelones |
55           | postcode     | 90700 |
56           | country      | Uruguay |
57           | country_code | uy |
58
59     Scenario Outline: Housenumber 0 can be found
60         When sending <format> search query "Pham Hung Road 0" with address
61         Then results contain
62           | display_name |
63           | ^.*, 0,.* |
64         And result addresses contain
65           | house_number |
66           | 0     |
67
68     Examples:
69         | format |
70         | xml |
71         | json |
72         | jsonv2 |
73         | geojson |
74
75     @Tiger
76     Scenario: TIGER house number
77         When sending json search query "323 22nd Street Southwest, Huron"
78         Then results contain
79          | osm_type |
80          | way |
81
82     Scenario: Search with class-type feature
83         When sending jsonv2 search query "Hotel in California"
84         Then results contain
85           | place_rank |
86           | 30 |
87
88     Scenario: Search with specific amenity
89         When sending json search query "[restaurant] Vaduz" with address
90         Then result addresses contain
91           | country |
92           | Liechtenstein |
93         And  results contain
94           | class   | type |
95           | amenity | restaurant |
96
97     Scenario: Search with key-value amenity
98         When sending json search query "[shop=hifi] hamburg"
99         Then results contain
100           | class | type |
101           | shop  | hifi |
102
103     Scenario: With multiple amenity search only the first is used
104         When sending json search query "[shop=hifi] [church] hamburg"
105         Then results contain
106           | class | type |
107           | shop  | hifi |
108
109     Scenario: With multiple amenity search only the first is used
110         When sending json search query "[church] [restaurant] hamburg"
111         Then results contain
112           | class   | type |
113           | amenity | place_of_worship |
114
115     Scenario: POI search near given coordinate
116         When sending json search query "restaurant near 47.16712,9.51100"
117         Then results contain
118           | class   | type |
119           | amenity | restaurant |
120
121     Scenario: Arbitrary key/value search near given coordinate
122         When sending json search query "[man_made=mast]  47.15739° N 9.61264° E"
123         Then results contain
124           | class    | type |
125           | man_made | mast |
126
127     Scenario: Arbitrary key/value search near given coordinate and named place
128         When sending json search query "[man_made=mast] amerlugalpe  47° 9′ 26″ N 9° 36′ 45″ E"
129         Then results contain
130           | class    | type |
131           | man_made | mast |
132
133     Scenario: Name search near given coordinate
134         When sending json search query "amerlugalpe, N 47.15739° E 9.61264°"
135         Then exactly 1 result is returned
136
137     Scenario: Name search near given coordinate without result
138         When sending json search query "amerlugalpe, N 47 15 7 W 9 61 26"
139         Then exactly 0 results are returned
140
141     Scenario: Arbitrary key/value search near a road
142         When sending json search query "[leisure=table_soccer_table] immenbusch"
143         Then results contain
144           | class   | type |
145           | leisure | table_soccer_table |
146
147     Scenario: Ignore other country codes in structured search with country
148         When sending json search query ""
149             | city | country |
150             | li   | de      |
151         Then exactly 0 results are returned
152
153     Scenario: Ignore country searches when query is restricted to countries
154         When sending json search query "de"
155             | countrycodes |
156             | li  |
157         Then exactly 0 results are returned
158
159     # https://trac.openstreetmap.org/ticket/5094
160     Scenario: housenumbers are ordered by complete match first
161         When sending json search query "6395 geminis, montevideo" with address
162         Then result addresses contain
163           | ID | house_number |
164           | 0  | 6395 |
165           | 1  | 6395 BIS |
166
167     Scenario Outline: Same Searches with white spaces 
168         When sending json search query "<data>"
169         Then exactly 1 result is returned
170         And results contain
171           | class   |
172           | building |
173
174     Examples:
175       | data |
176       | amerlugalpe, N 47.15739° E 9.61264° |
177       | amerlugalpe,    N 47.15739° E 9.61264° |
178       |         amerlugalpe     ,       N 47.15739° E 9.61264° |
179       | amerlugalpe, N 47.15739°               E 9.61264° |
180       | amerlugalpe\v, N 47.15739° E    9.61264° |
181
182     Scenario: Searched with white spaces
183         When sending json search query "22nd    Street Southwest\v,\fHuron"
184         Then results contain
185           | class   | type |
186           | highway | residential |