forked from hans/Nominatim
Merge pull request #1974 from lonvia/show-unknown-addr-place
add unknown addr:place to address output
This commit is contained in:
@@ -101,6 +101,7 @@ DECLARE
|
|||||||
postcode_isexact BOOL;
|
postcode_isexact BOOL;
|
||||||
searchclass TEXT;
|
searchclass TEXT;
|
||||||
searchtype TEXT;
|
searchtype TEXT;
|
||||||
|
search_unlisted_place TEXT;
|
||||||
countryname HSTORE;
|
countryname HSTORE;
|
||||||
BEGIN
|
BEGIN
|
||||||
-- The place ein question might not have a direct entry in place_addressline.
|
-- The place ein question might not have a direct entry in place_addressline.
|
||||||
@@ -155,11 +156,13 @@ BEGIN
|
|||||||
IF for_place_id IS NULL THEN
|
IF for_place_id IS NULL THEN
|
||||||
SELECT parent_place_id, country_code, housenumber, rank_search,
|
SELECT parent_place_id, country_code, housenumber, rank_search,
|
||||||
postcode, address is not null and address ? 'postcode',
|
postcode, address is not null and address ? 'postcode',
|
||||||
name, class, type
|
name, class, type,
|
||||||
|
address -> '_unlisted_place' as unlisted_place
|
||||||
FROM placex
|
FROM placex
|
||||||
WHERE place_id = in_place_id and rank_search > 27
|
WHERE place_id = in_place_id and rank_search > 27
|
||||||
INTO for_place_id, searchcountrycode, searchhousenumber, searchrankaddress,
|
INTO for_place_id, searchcountrycode, searchhousenumber, searchrankaddress,
|
||||||
searchpostcode, postcode_isexact, searchhousename, searchclass, searchtype;
|
searchpostcode, postcode_isexact, searchhousename, searchclass,
|
||||||
|
searchtype, search_unlisted_place;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
-- If for_place_id is still NULL at this point then the object has its own
|
-- If for_place_id is still NULL at this point then the object has its own
|
||||||
@@ -279,6 +282,11 @@ BEGIN
|
|||||||
RETURN NEXT location;
|
RETURN NEXT location;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
|
IF search_unlisted_place is not null THEN
|
||||||
|
RETURN NEXT ROW(null, null, null, hstore('name', search_unlisted_place),
|
||||||
|
'place', 'locality', null, null, true, true, 26, 0)::addressline;
|
||||||
|
END IF;
|
||||||
|
|
||||||
IF searchpostcode IS NOT NULL THEN
|
IF searchpostcode IS NOT NULL THEN
|
||||||
location := ROW(null, null, null, hstore('ref', searchpostcode), 'place',
|
location := ROW(null, null, null, hstore('ref', searchpostcode), 'place',
|
||||||
'postcode', null, null, false, true, 5, 0)::addressline;
|
'postcode', null, null, false, true, 5, 0)::addressline;
|
||||||
|
|||||||
@@ -575,6 +575,7 @@ BEGIN
|
|||||||
-- update not necessary for osmline, cause linked_place_id does not exist
|
-- update not necessary for osmline, cause linked_place_id does not exist
|
||||||
|
|
||||||
NEW.extratags := NEW.extratags - 'linked_place'::TEXT;
|
NEW.extratags := NEW.extratags - 'linked_place'::TEXT;
|
||||||
|
NEW.address := NEW.address - '_unlisted_place'::TEXT;
|
||||||
|
|
||||||
IF NEW.linked_place_id is not null THEN
|
IF NEW.linked_place_id is not null THEN
|
||||||
--DEBUG: RAISE WARNING 'place already linked to %', NEW.linked_place_id;
|
--DEBUG: RAISE WARNING 'place already linked to %', NEW.linked_place_id;
|
||||||
@@ -740,9 +741,18 @@ BEGIN
|
|||||||
IF NEW.parent_place_id is not null THEN
|
IF NEW.parent_place_id is not null THEN
|
||||||
|
|
||||||
-- Get the details of the parent road
|
-- Get the details of the parent road
|
||||||
SELECT p.country_code, p.postcode FROM placex p
|
SELECT p.country_code, p.postcode, p.name FROM placex p
|
||||||
WHERE p.place_id = NEW.parent_place_id INTO location;
|
WHERE p.place_id = NEW.parent_place_id INTO location;
|
||||||
|
|
||||||
|
IF addr_street is null and addr_place is not null THEN
|
||||||
|
-- Check if the addr:place tag is part of the parent name
|
||||||
|
SELECT count(*) INTO i
|
||||||
|
FROM svals(location.name) AS pname WHERE pname = addr_place;
|
||||||
|
IF i = 0 THEN
|
||||||
|
NEW.address = NEW.address || hstore('_unlisted_place', addr_place);
|
||||||
|
END IF;
|
||||||
|
END IF;
|
||||||
|
|
||||||
NEW.country_code := location.country_code;
|
NEW.country_code := location.country_code;
|
||||||
--DEBUG: RAISE WARNING 'Got parent details from search name';
|
--DEBUG: RAISE WARNING 'Got parent details from search name';
|
||||||
|
|
||||||
|
|||||||
@@ -27,8 +27,8 @@ Feature: Creation of search terms
|
|||||||
| N1 | #23 | Rose Street, Walltown |
|
| N1 | #23 | Rose Street, Walltown |
|
||||||
When searching for "23 Rose Street, Walltown"
|
When searching for "23 Rose Street, Walltown"
|
||||||
Then results contain
|
Then results contain
|
||||||
| osm_type | osm_id |
|
| osm_type | osm_id | name |
|
||||||
| N | 1 |
|
| N | 1 | 23, Rose Street |
|
||||||
|
|
||||||
Scenario: Unnamed POI has no search entry when it has known addr: tags
|
Scenario: Unnamed POI has no search entry when it has known addr: tags
|
||||||
Given the scene roads-with-pois
|
Given the scene roads-with-pois
|
||||||
@@ -42,8 +42,8 @@ Feature: Creation of search terms
|
|||||||
Then search_name has no entry for N1
|
Then search_name has no entry for N1
|
||||||
When searching for "23 Rose Street, Walltown"
|
When searching for "23 Rose Street, Walltown"
|
||||||
Then results contain
|
Then results contain
|
||||||
| osm_type | osm_id |
|
| osm_type | osm_id | name |
|
||||||
| N | 1 |
|
| N | 1 | 23, Rose Street |
|
||||||
|
|
||||||
Scenario: Unnamed POI must have a house number to get a search entry
|
Scenario: Unnamed POI must have a house number to get a search entry
|
||||||
Given the scene roads-with-pois
|
Given the scene roads-with-pois
|
||||||
@@ -72,12 +72,12 @@ Feature: Creation of search terms
|
|||||||
When searching for "23 Rose Street"
|
When searching for "23 Rose Street"
|
||||||
Then exactly 1 results are returned
|
Then exactly 1 results are returned
|
||||||
And results contain
|
And results contain
|
||||||
| osm_type | osm_id |
|
| osm_type | osm_id | name |
|
||||||
| W | 1 |
|
| W | 1 | Rose Street, Strange Town |
|
||||||
When searching for "23 Walltown"
|
When searching for "23 Walltown"
|
||||||
Then results contain
|
Then results contain
|
||||||
| osm_type | osm_id |
|
| osm_type | osm_id | name |
|
||||||
| N | 1 |
|
| N | 1 | 23, Walltown, Strange Town |
|
||||||
|
|
||||||
Scenario: Unnamed POIs doesn't inherit parent name when addr:place is present only in parent address
|
Scenario: Unnamed POIs doesn't inherit parent name when addr:place is present only in parent address
|
||||||
Given the scene roads-with-pois
|
Given the scene roads-with-pois
|
||||||
@@ -95,13 +95,13 @@ Feature: Creation of search terms
|
|||||||
When searching for "23 Rose Street, Walltown"
|
When searching for "23 Rose Street, Walltown"
|
||||||
Then exactly 1 result is returned
|
Then exactly 1 result is returned
|
||||||
And results contain
|
And results contain
|
||||||
| osm_type | osm_id |
|
| osm_type | osm_id | name |
|
||||||
| W | 1 |
|
| W | 1 | Rose Street, Strange Town |
|
||||||
When searching for "23 Walltown"
|
When searching for "23 Walltown"
|
||||||
Then exactly 1 result is returned
|
Then exactly 1 result is returned
|
||||||
And results contain
|
And results contain
|
||||||
| osm_type | osm_id |
|
| osm_type | osm_id | name |
|
||||||
| N | 1 |
|
| N | 1 | 23, Walltown, Strange Town |
|
||||||
|
|
||||||
Scenario: Unnamed POIs does inherit parent name when unknown addr:place and addr:street is present
|
Scenario: Unnamed POIs does inherit parent name when unknown addr:place and addr:street is present
|
||||||
Given the scene roads-with-pois
|
Given the scene roads-with-pois
|
||||||
@@ -115,8 +115,8 @@ Feature: Creation of search terms
|
|||||||
Then search_name has no entry for N1
|
Then search_name has no entry for N1
|
||||||
When searching for "23 Rose Street"
|
When searching for "23 Rose Street"
|
||||||
Then results contain
|
Then results contain
|
||||||
| osm_type | osm_id |
|
| osm_type | osm_id | name |
|
||||||
| N | 1 |
|
| N | 1 | 23, Rose Street |
|
||||||
When searching for "23 Lily Street"
|
When searching for "23 Lily Street"
|
||||||
Then exactly 0 results are returned
|
Then exactly 0 results are returned
|
||||||
|
|
||||||
@@ -132,8 +132,8 @@ Feature: Creation of search terms
|
|||||||
Then search_name has no entry for N1
|
Then search_name has no entry for N1
|
||||||
When searching for "23 Rose Street"
|
When searching for "23 Rose Street"
|
||||||
Then results contain
|
Then results contain
|
||||||
| osm_type | osm_id |
|
| osm_type | osm_id | name |
|
||||||
| N | 1 |
|
| N | 1 | 23, Rose Street |
|
||||||
When searching for "23 Lily Street"
|
When searching for "23 Lily Street"
|
||||||
Then exactly 0 results are returned
|
Then exactly 0 results are returned
|
||||||
|
|
||||||
@@ -151,8 +151,8 @@ Feature: Creation of search terms
|
|||||||
| N1 | #Green Moss | Rose Street, Walltown |
|
| N1 | #Green Moss | Rose Street, Walltown |
|
||||||
When searching for "Green Moss, Rose Street, Walltown"
|
When searching for "Green Moss, Rose Street, Walltown"
|
||||||
Then results contain
|
Then results contain
|
||||||
| osm_type | osm_id |
|
| osm_type | osm_id | name |
|
||||||
| N | 1 |
|
| N | 1 | Green Moss, Rose Street |
|
||||||
|
|
||||||
Scenario: Named POI doesn't inherit parent name when addr:place is present only in parent address
|
Scenario: Named POI doesn't inherit parent name when addr:place is present only in parent address
|
||||||
Given the scene roads-with-pois
|
Given the scene roads-with-pois
|
||||||
@@ -171,8 +171,8 @@ Feature: Creation of search terms
|
|||||||
Then exactly 0 result is returned
|
Then exactly 0 result is returned
|
||||||
When searching for "Green Moss, Walltown"
|
When searching for "Green Moss, Walltown"
|
||||||
Then results contain
|
Then results contain
|
||||||
| osm_type | osm_id |
|
| osm_type | osm_id | name |
|
||||||
| N | 1 |
|
| N | 1 | Green Moss, Walltown, Strange Town |
|
||||||
|
|
||||||
Scenario: Named POIs inherit address from parent
|
Scenario: Named POIs inherit address from parent
|
||||||
Given the scene roads-with-pois
|
Given the scene roads-with-pois
|
||||||
|
|||||||
Reference in New Issue
Block a user