X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/9d83da830f349b746c72b1df2a7526d517552b72..d44a428b744916a21c2d82d654f1358efe027d21:/nominatim/clicmd/special_phrases.py diff --git a/nominatim/clicmd/special_phrases.py b/nominatim/clicmd/special_phrases.py index ecd01c91..b20a4101 100644 --- a/nominatim/clicmd/special_phrases.py +++ b/nominatim/clicmd/special_phrases.py @@ -27,6 +27,8 @@ class ImportSpecialPhrases: help='Import special phrases from the OSM wiki to the database.') group.add_argument('--import-from-csv', metavar='FILE', help='Import special phrases from a CSV file.') + group.add_argument('--no-replace', action='store_true', + help='Keep the old phrases and only add the new ones.') @staticmethod def run(args): @@ -46,12 +48,13 @@ class ImportSpecialPhrases: def start_import(args, loader): """ Create the SPImporter object containing the right - SPLoader and then start the import of special phrases. + sp loader and then start the import of special phrases. """ from ..tokenizer import factory as tokenizer_factory tokenizer = tokenizer_factory.get_tokenizer_for_db(args.config) + should_replace = not args.no_replace with connect(args.config.get_libpq_dsn()) as db_connection: SPImporter( args.config, args.phplib_dir, db_connection, loader - ).import_phrases(tokenizer) + ).import_phrases(tokenizer, should_replace)