Change command 'import-special-phrases --from-wiki' to 'special-phrases --import-from-wiki'.

This commit is contained in:
AntoJvlt
2021-03-26 01:57:51 +01:00
parent cde9389e75
commit 57ce75eb67
7 changed files with 9 additions and 9 deletions

View File

@@ -120,7 +120,7 @@ jobs:
working-directory: data-env working-directory: data-env
- name: Import special phrases - name: Import special phrases
run: nominatim special-phrases --from-wiki | psql -d nominatim run: nominatim special-phrases --import-from-wiki
working-directory: data-env working-directory: data-env
- name: Check import - name: Check import

View File

@@ -270,7 +270,7 @@ If you want to be able to search for places by their type through
[special key phrases](https://wiki.openstreetmap.org/wiki/Nominatim/Special_Phrases) [special key phrases](https://wiki.openstreetmap.org/wiki/Nominatim/Special_Phrases)
you also need to import these key phrases like this: you also need to import these key phrases like this:
nominatim import-special-phrases --from-wiki nominatim special-phrases --import-from-wiki
Note that this command downloads the phrases from the wiki link above. You Note that this command downloads the phrases from the wiki link above. You
need internet access for the step. need internet access for the step.

View File

@@ -7,5 +7,5 @@ require_once(CONST_LibDir.'/init-cmd.php');
loadSettings(getcwd()); loadSettings(getcwd());
(new \Nominatim\Shell(getSetting('NOMINATIM_TOOL'))) (new \Nominatim\Shell(getSetting('NOMINATIM_TOOL')))
->addParams('import-special-phrases', '--from-wiki') ->addParams('special-phrases', '--import-from-wiki')
->run(); ->run();

View File

@@ -254,7 +254,7 @@ def nominatim(**kwargs):
parser.add_subcommand('freeze', clicmd.SetupFreeze) parser.add_subcommand('freeze', clicmd.SetupFreeze)
parser.add_subcommand('replication', clicmd.UpdateReplication) parser.add_subcommand('replication', clicmd.UpdateReplication)
parser.add_subcommand('import-special-phrases', clicmd.ImportSpecialPhrases) parser.add_subcommand('special-phrases', clicmd.ImportSpecialPhrases)
parser.add_subcommand('add-data', UpdateAddData) parser.add_subcommand('add-data', UpdateAddData)
parser.add_subcommand('index', clicmd.UpdateIndex) parser.add_subcommand('index', clicmd.UpdateIndex)

View File

@@ -1,5 +1,5 @@
""" """
Implementation of the 'import-special-phrases' command. Implementation of the 'special-phrases' command.
""" """
import logging import logging
from nominatim.tools.special_phrases import SpecialPhrasesImporter from nominatim.tools.special_phrases import SpecialPhrasesImporter
@@ -17,12 +17,12 @@ class ImportSpecialPhrases:
@staticmethod @staticmethod
def add_args(parser): def add_args(parser):
group = parser.add_argument_group('Input arguments') group = parser.add_argument_group('Input arguments')
group.add_argument('--from-wiki', action='store_true', group.add_argument('--import-from-wiki', action='store_true',
help='Import special phrases from the OSM wiki to the database.') help='Import special phrases from the OSM wiki to the database.')
@staticmethod @staticmethod
def run(args): def run(args):
if args.from_wiki: if args.import_from_wiki:
LOG.warning('Special phrases importation starting') LOG.warning('Special phrases importation starting')
with connect(args.config.get_libpq_dsn()) as db_connection: with connect(args.config.get_libpq_dsn()) as db_connection:
SpecialPhrasesImporter( SpecialPhrasesImporter(

View File

@@ -174,7 +174,7 @@ def test_index_command(mock_func_factory, temp_db_cursor, params, do_bnds, do_ra
def test_special_phrases_command(temp_db, mock_func_factory): def test_special_phrases_command(temp_db, mock_func_factory):
func = mock_func_factory(nominatim.clicmd.special_phrases.SpecialPhrasesImporter, 'import_from_wiki') func = mock_func_factory(nominatim.clicmd.special_phrases.SpecialPhrasesImporter, 'import_from_wiki')
call_nominatim('import-special-phrases', '--from-wiki') call_nominatim('special-phrases', '--import-from-wiki')
assert func.called == 1 assert func.called == 1