import random
from ..errors import UsageError
-from ..db.connection import connect
+from ..db.connection import connect, table_exists
from .args import NominatimArgs
# Do not repeat documentation of subcommand classes.
mgroup.add_argument('--place-id', type=int,
help='Analyse indexing of the given Nominatim object')
-
def run(self, args: NominatimArgs) -> int:
# pylint: disable=too-many-return-statements
if args.warm:
return 1
-
def _warm(self, args: NominatimArgs) -> int:
try:
import nominatim_api as napi
tokenizer = tokenizer_factory.get_tokenizer_for_db(args.config)
with connect(args.config.get_libpq_dsn()) as conn:
- if conn.table_exists('search_name'):
+ if table_exists(conn, 'search_name'):
words = tokenizer.most_frequent_words(conn, 1000)
else:
words = []