mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-26 11:08:13 +00:00
move update code for postcode and word count to Python
Adds also tests for the new function to execute a SQL script.
This commit is contained in:
16
nominatim/tools/refresh.py
Normal file
16
nominatim/tools/refresh.py
Normal file
@@ -0,0 +1,16 @@
|
||||
"""
|
||||
Functions for bringing auxiliary data in the database up-to-date.
|
||||
"""
|
||||
from ..db.utils import execute_file
|
||||
|
||||
def update_postcodes(conn, datadir):
|
||||
""" Recalculate postcode centroids and add, remove and update entries in the
|
||||
location_postcode table. `conn` is an opne connection to the database.
|
||||
"""
|
||||
execute_file(conn, datadir / 'sql' / 'update-postcodes.sql')
|
||||
|
||||
|
||||
def recompute_word_counts(conn, datadir):
|
||||
""" Compute the frequency of full-word search terms.
|
||||
"""
|
||||
execute_file(conn, datadir / 'sql' / 'words_from_search_name.sql')
|
||||
Reference in New Issue
Block a user