Skip to content

Commit

Permalink
switch back meaning of reverse and search in warm
Browse files Browse the repository at this point in the history
Also do'n try to warm up searches on reverse-only databases.

Fixes #3213.
  • Loading branch information
lonvia committed Oct 4, 2023
1 parent 0f19695 commit f1fbcd8
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions nominatim/clicmd/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,17 +90,20 @@ def _warm(self, args: NominatimArgs) -> int:
api = napi.NominatimAPI(args.project_dir)

try:
if args.target != 'reverse':
if args.target != 'search':
for _ in range(1000):
api.reverse((random.uniform(-90, 90), random.uniform(-180, 180)),
address_details=True)

if args.target != 'search':
if args.target != 'reverse':
from ..tokenizer import factory as tokenizer_factory

tokenizer = tokenizer_factory.get_tokenizer_for_db(args.config)
with connect(args.config.get_libpq_dsn()) as conn:
words = tokenizer.most_frequent_words(conn, 1000)
if conn.table_exists('search_name'):
words = tokenizer.most_frequent_words(conn, 1000)
else:
words = []

for word in words:
api.search(word)
Expand Down

0 comments on commit f1fbcd8

Please sign in to comment.