reintroduce 'name:' prefix to country name keys

This commit is contained in:
Tareq Al-Ahdal
2022-03-13 18:58:27 +08:00
parent 3939cb614e
commit 165d17f7f7
2 changed files with 254 additions and 254 deletions

View File

@@ -7,12 +7,12 @@
""" """
Functions for importing and managing static country information. Functions for importing and managing static country information.
""" """
import json
import psycopg2.extras import psycopg2.extras
from nominatim.db import utils as db_utils from nominatim.db import utils as db_utils
from nominatim.db.connection import connect from nominatim.db.connection import connect
from io import StringIO from io import StringIO
import json
class _CountryInfo: class _CountryInfo:
""" Caches country-specific properties from the configuration file. """ Caches country-specific properties from the configuration file.
@@ -109,8 +109,8 @@ def create_country_names(conn, tokenizer, languages=None):
languages = languages.split(',') languages = languages.split(',')
def _include_key(key): def _include_key(key):
return key == 'default' or \ return key == 'name' or \
(not languages or key in languages) (key.startswith('name:') and (not languages or key[5:] in languages))
with conn.cursor() as cur: with conn.cursor() as cur:
psycopg2.extras.register_hstore(cur) psycopg2.extras.register_hstore(cur)

File diff suppressed because one or more lines are too long