]> git.openstreetmap.org Git - nominatim.git/blobdiff - nominatim/clicmd/transition.py
Merge remote-tracking branch 'upstream/master'
[nominatim.git] / nominatim / clicmd / transition.py
index e8e40646b8a87688935b36aae1b3f077c3b42933..c9341f496d57efac9fd3527fdfffe3ba73618be1 100644 (file)
@@ -41,6 +41,10 @@ class AdminTransition:
                            help='Create required partition tables')
         group.add_argument('--index', action='store_true',
                            help='Index the data')
+        group.add_argument('--create-search-indices', action='store_true',
+                           help='Create additional indices required for search and update')
+        group.add_argument('--create-country-names', action='store_true',
+                           help='Create search index for default country names.')
         group = parser.add_argument_group('Options')
         group.add_argument('--no-partitions', action='store_true',
                            help='Do not partition search indices')
@@ -56,10 +60,12 @@ class AdminTransition:
                            help="Ignore certain erros on import.")
         group.add_argument('--reverse-only', action='store_true',
                            help='Do not create search tables and indexes')
+        group.add_argument('--tiger-data', metavar='FILE',
+                           help='File to import')
 
     @staticmethod
-    def run(args):
-        from ..tools import database_import
+    def run(args): # pylint: disable=too-many-statements
+        from ..tools import database_import, tiger_data
         from ..tools import refresh
 
         if args.create_db:
@@ -120,3 +126,21 @@ class AdminTransition:
             from ..indexer.indexer import Indexer
             indexer = Indexer(args.config.get_libpq_dsn(), args.threads or 1)
             indexer.index_full()
+
+        if args.create_search_indices:
+            LOG.warning('Create Search indices')
+            with connect(args.config.get_libpq_dsn()) as conn:
+                database_import.create_search_indices(conn, args.config, args.sqllib_dir, args.drop)
+
+        if args.tiger_data:
+            LOG.warning('Tiger data')
+            tiger_data.add_tiger_data(args.config.get_libpq_dsn(),
+                                      args.tiger_data,
+                                      args.threads or 1,
+                                      args.config,
+                                      args.sqllib_dir)
+
+        if args.create_country_names:
+            LOG.warning('Create search index for default country names.')
+            with connect(args.config.get_libpq_dsn()) as conn:
+                database_import.create_country_names(conn, args.config)