Indexing: fixup: add presence check for hstore name field

This commit is contained in:
James Addison
2026-02-15 23:26:28 +00:00
parent d1b0bcaea7
commit 53e8334206
2 changed files with 13 additions and 8 deletions

View File

@@ -89,7 +89,7 @@ BEGIN
-- Add the linked-place (e.g. city) name as a searchable placename in the default language (if any)
default_language := get_country_language_code(location.country_code);
IF default_language is not NULL AND NOT location.name ? ('name:' || default_language) THEN
IF default_language is not NULL AND location.name ? 'name' AND NOT location.name ? ('name:' || default_language) THEN
location.name := location.name || hstore('name:' || default_language, location.name->'name');
END IF;

View File

@@ -299,18 +299,23 @@ Feature: Linking of places
Scenario: Linked places expand default language names
Given the grid with origin CO
| 1 | | 2 |
| | 9 | |
| 4 | | 3 |
Given the places
| 1 | | 2 | | 5 | | 6 |
| | 9 | | | | 10 | |
| 4 | | 3 | | 8 | | 7 |
And the places
| osm | class | type | name+name | geometry |
| N9 | place | city | Popayán | 9 |
Given the places
And the places
| osm | class | type | name+name:en | geometry |
| N10 | place | city | Open | 10 |
And the places
| osm | class | type | name+name | geometry | admin |
| R1 | boundary | administrative | Perímetro Urbano Popayán | (1,2,3,4,1) | 8 |
| R2 | boundary | administrative | Abre | (5,6,7,8,5) | 8 |
And the relations
| id | members |
| 1 | N9:label |
| id | members |
| 1 | N9:label |
| 2 | N10:label |
When importing
Then placex contains
| object | linked_place_id |