]> git.openstreetmap.org Git - nominatim.git/blob - test/bdd/db/query/postcodes.feature
remove special casing for legacy tokenizer from BDD tests
[nominatim.git] / test / bdd / db / query / postcodes.feature
1 @DB
2 Feature: Querying fo postcode variants
3
4     Scenario: Postcodes in Singapore (6-digit postcode)
5         Given the grid with origin SG
6             | 10 |   |   |   | 11 |
7         And the places
8             | osm | class   | type | name   | addr+postcode | geometry |
9             | W1  | highway | path | Lorang | 399174        | 10,11    |
10         When importing
11         When sending search query "399174"
12         Then results contain
13             | ID | type     | display_name |
14             | 0  | postcode | 399174, Singapore |
15
16
17     Scenario Outline: Postcodes in the Netherlands (mixed postcode with spaces)
18         Given the grid with origin NL
19             | 10 |   |   |   | 11 |
20         And the places
21             | osm | class   | type | name     | addr+postcode | geometry |
22             | W1  | highway | path | De Weide | 3993 DX       | 10,11    |
23         When importing
24         When sending search query "3993 DX"
25         Then results contain
26             | ID | type     | display_name |
27             | 0  | postcode | 3993 DX, Nederland      |
28         When sending search query "3993dx"
29         Then results contain
30             | ID | type     | display_name |
31             | 0  | postcode | 3993 DX, Nederland      |
32
33         Examples:
34             | postcode |
35             | 3993 DX  |
36             | 3993DX   |
37             | 3993 dx  |
38
39
40     Scenario: Postcodes in Singapore (6-digit postcode)
41         Given the grid with origin SG
42             | 10 |   |   |   | 11 |
43         And the places
44             | osm | class   | type | name   | addr+postcode | geometry |
45             | W1  | highway | path | Lorang | 399174        | 10,11    |
46         When importing
47         When sending search query "399174"
48         Then results contain
49             | ID | type     | display_name |
50             | 0  | postcode | 399174, Singapore       |
51
52
53     Scenario Outline: Postcodes in Andorra (with country code)
54         Given the grid with origin AD
55             | 10 |   |   |   | 11 |
56         And the places
57             | osm | class   | type | name   | addr+postcode | geometry |
58             | W1  | highway | path | Lorang | <postcode>    | 10,11    |
59         When importing
60         When sending search query "675"
61         Then results contain
62             | ID | type     | display_name |
63             | 0  | postcode | AD675, Andorra |
64         When sending search query "AD675"
65         Then results contain
66             | ID | type     | display_name |
67             | 0  | postcode | AD675, Andorra |
68
69         Examples:
70             | postcode |
71             | 675      |
72             | AD 675   |
73             | AD675    |
74
75
76     Scenario: Different postcodes with the same normalization can both be found
77         Given the places
78            | osm | class | type  | addr+postcode | addr+housenumber | geometry |
79            | N34 | place | house | EH4 7EA       | 111              | country:gb |
80            | N35 | place | house | E4 7EA        | 111              | country:gb |
81         When importing
82         Then location_postcode contains exactly
83            | country | postcode | geometry |
84            | gb      | EH4 7EA  | country:gb |
85            | gb      | E4 7EA   | country:gb |
86         When sending search query "EH4 7EA"
87         Then results contain
88            | type     | display_name |
89            | postcode | EH4 7EA, United Kingdom |
90         When sending search query "E4 7EA"
91         Then results contain
92            | type     | display_name |
93            | postcode | E4 7EA, United Kingdom |
94
95
96     Scenario: Postcode areas are preferred over postcode points
97         Given the grid with origin DE
98             | 1 | 2 |
99             | 4 | 3 |
100         Given the places
101             | osm | class    | type        | postcode | geometry    |
102             | R23 | boundary | postal_code | 12345    | (1,2,3,4,1) |
103         When importing
104         Then location_postcode contains exactly
105           | country | postcode |
106           | de      | 12345    |
107         When sending search query "12345, de"
108         Then results contain
109           | osm |
110           | R23 |