mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-16 15:47:58 +00:00
introduce external processing in indexer
Indexing is now split into three parts: first a preparation step that collects the necessary information from the database and returns it to Python. In a second step the data is transformed within Python as necessary and then returned to the database through the usual UPDATE which now not only sets the indexed_status but also other fields. The third step comprises the address computation which is still done inside the update trigger in the database. The second processing step doesn't do anything useful yet.
This commit is contained in:
@@ -106,9 +106,19 @@ class NominatimEnvironment:
|
||||
self.website_dir.cleanup()
|
||||
|
||||
self.website_dir = tempfile.TemporaryDirectory()
|
||||
cfg = Configuration(None, self.src_dir / 'settings', environ=self.test_env)
|
||||
cfg.lib_dir.php = self.src_dir / 'lib-php'
|
||||
refresh.setup_website(Path(self.website_dir.name) / 'website', cfg)
|
||||
refresh.setup_website(Path(self.website_dir.name) / 'website',
|
||||
self.get_test_config())
|
||||
|
||||
|
||||
def get_test_config(self):
|
||||
cfg = Configuration(Path(self.website_dir.name), self.src_dir / 'settings',
|
||||
environ=self.test_env)
|
||||
cfg.set_libdirs(module=self.build_dir / 'module',
|
||||
osm2pgsql=self.build_dir / 'osm2pgsql' / 'osm2pgsql',
|
||||
php=self.src_dir / 'lib-php',
|
||||
sql=self.src_dir / 'lib-sql',
|
||||
data=self.src_dir / 'data')
|
||||
return cfg
|
||||
|
||||
def get_libpq_dsn(self):
|
||||
dsn = self.test_env['NOMINATIM_DATABASE_DSN']
|
||||
|
||||
@@ -7,6 +7,7 @@ from place_inserter import PlaceColumn
|
||||
from table_compare import NominatimID, DBRow
|
||||
|
||||
from nominatim.indexer import indexer
|
||||
from nominatim.tokenizer import factory as tokenizer_factory
|
||||
|
||||
def check_database_integrity(context):
|
||||
""" Check some generic constraints on the tables.
|
||||
@@ -86,6 +87,9 @@ def add_data_to_planet_ways(context):
|
||||
def import_and_index_data_from_place_table(context):
|
||||
""" Import data previously set up in the place table.
|
||||
"""
|
||||
nctx = context.nominatim
|
||||
|
||||
tokenizer = tokenizer_factory.create_tokenizer(nctx.get_test_config())
|
||||
context.nominatim.copy_from_place(context.db)
|
||||
|
||||
# XXX use tool function as soon as it is ported
|
||||
|
||||
Reference in New Issue
Block a user