mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-03-07 02:24:08 +00:00
fix postcode-related tests
This commit is contained in:
@@ -265,6 +265,7 @@ DECLARE
|
|||||||
BEGIN
|
BEGIN
|
||||||
rank_search := 30;
|
rank_search := 30;
|
||||||
rank_address := 30;
|
rank_address := 30;
|
||||||
|
postcode := upper(postcode);
|
||||||
|
|
||||||
IF country_code = 'gb' THEN
|
IF country_code = 'gb' THEN
|
||||||
IF postcode ~ '^([A-Z][A-Z]?[0-9][0-9A-Z]? [0-9][A-Z][A-Z])$' THEN
|
IF postcode ~ '^([A-Z][A-Z]?[0-9][0-9A-Z]? [0-9][A-Z][A-Z])$' THEN
|
||||||
@@ -824,9 +825,9 @@ BEGIN
|
|||||||
RETURN NULL;
|
RETURN NULL;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
NEW.name := hstore('ref', NEW.postcode);
|
NEW.name := hstore('ref', NEW.address->'postcode');
|
||||||
|
|
||||||
SELECT * FROM get_postcode_rank(NEW.country_code, NEW.postcode)
|
SELECT * FROM get_postcode_rank(NEW.country_code, NEW.address->'postcode')
|
||||||
INTO NEW.rank_search, NEW.rank_address;
|
INTO NEW.rank_search, NEW.rank_address;
|
||||||
|
|
||||||
ELSEIF NEW.class = 'place' THEN
|
ELSEIF NEW.class = 'place' THEN
|
||||||
|
|||||||
@@ -23,17 +23,3 @@ Feature: Creation of search terms
|
|||||||
Then search_name contains
|
Then search_name contains
|
||||||
| object | name_vector | nameaddress_vector |
|
| object | name_vector | nameaddress_vector |
|
||||||
| N1 | foo | the road |
|
| N1 | foo | the road |
|
||||||
|
|
||||||
Scenario: Roads take over the postcode from attached houses
|
|
||||||
Given the scene roads-with-pois
|
|
||||||
And the places
|
|
||||||
| osm | class | type | housenr | postcode | street | geometry |
|
|
||||||
| N1 | place | house | 1 | 12345 | North St | :p-S1 |
|
|
||||||
And the places
|
|
||||||
| osm | class | type | name | geometry |
|
|
||||||
| W1 | highway | residential | North St | :w-north |
|
|
||||||
When importing
|
|
||||||
Then search_name contains
|
|
||||||
| object | nameaddress_vector |
|
|
||||||
| W1 | 12345 |
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,57 +0,0 @@
|
|||||||
@DB
|
|
||||||
Feature: Update of POI-inherited poscode
|
|
||||||
Test updates of postcodes on street which was inherited from a related POI
|
|
||||||
|
|
||||||
Background: Street and house with postcode
|
|
||||||
Given the scene roads-with-pois
|
|
||||||
And the places
|
|
||||||
| osm | class | type | housenr | postcode | street | geometry |
|
|
||||||
| N1 | place | house | 1 | 12345 | North St |:p-S1 |
|
|
||||||
And the places
|
|
||||||
| osm | class | type | name | geometry |
|
|
||||||
| W1 | highway | residential | North St | :w-north |
|
|
||||||
When importing
|
|
||||||
Then search_name contains
|
|
||||||
| object | nameaddress_vector |
|
|
||||||
| W1 | 12345 |
|
|
||||||
|
|
||||||
Scenario: POI-inherited postcode remains when way type is changed
|
|
||||||
When updating places
|
|
||||||
| osm | class | type | name | geometry |
|
|
||||||
| W1 | highway | unclassified | North St | :w-north |
|
|
||||||
Then search_name contains
|
|
||||||
| object | nameaddress_vector |
|
|
||||||
| W1 | 12345 |
|
|
||||||
|
|
||||||
Scenario: POI-inherited postcode remains when way name is changed
|
|
||||||
When updating places
|
|
||||||
| osm | class | type | name | geometry |
|
|
||||||
| W1 | highway | unclassified | South St | :w-north |
|
|
||||||
Then search_name contains
|
|
||||||
| object | nameaddress_vector |
|
|
||||||
| W1 | 12345 |
|
|
||||||
|
|
||||||
Scenario: POI-inherited postcode remains when way geometry is changed
|
|
||||||
When updating places
|
|
||||||
| osm | class | type | name | geometry |
|
|
||||||
| W1 | highway | unclassified | South St | :w-south |
|
|
||||||
Then search_name contains
|
|
||||||
| object | nameaddress_vector |
|
|
||||||
| W1 | 12345 |
|
|
||||||
|
|
||||||
Scenario: POI-inherited postcode is added when POI postcode changes
|
|
||||||
When updating places
|
|
||||||
| osm | class | type | housenr | postcode | street | geometry |
|
|
||||||
| N1 | place | house | 1 | 54321 | North St |:p-S1 |
|
|
||||||
Then search_name contains
|
|
||||||
| object | nameaddress_vector |
|
|
||||||
| W1 | 54321 |
|
|
||||||
|
|
||||||
Scenario: POI-inherited postcode remains when POI geometry changes
|
|
||||||
When updating places
|
|
||||||
| osm | class | type | housenr | postcode | street | geometry |
|
|
||||||
| N1 | place | house | 1 | 12345 | North St |:p-S2 |
|
|
||||||
Then search_name contains
|
|
||||||
| object | nameaddress_vector |
|
|
||||||
| W1 | 12345 |
|
|
||||||
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
@DB
|
|
||||||
Feature: Update of search terms
|
|
||||||
Tests that search_name table is updated correctly
|
|
||||||
|
|
||||||
Scenario: POI-inherited postcode remains when another POI is deleted
|
|
||||||
Given the scene roads-with-pois
|
|
||||||
And the places
|
|
||||||
| osm | class | type | housenr | postcode | street | geometry |
|
|
||||||
| N1 | place | house | 1 | 12345 | North St |:p-S1 |
|
|
||||||
| N2 | place | house | 2 | | North St |:p-S2 |
|
|
||||||
And the places
|
|
||||||
| osm | class | type | name | geometry |
|
|
||||||
| W1 | highway | residential | North St | :w-north |
|
|
||||||
When importing
|
|
||||||
Then search_name contains
|
|
||||||
| object | nameaddress_vector |
|
|
||||||
| W1 | 12345 |
|
|
||||||
When marking for delete N2
|
|
||||||
Then search_name contains
|
|
||||||
| object | nameaddress_vector |
|
|
||||||
| W1 | 12345 |
|
|
||||||
Reference in New Issue
Block a user