mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-03-12 05:44:06 +00:00
adapt plugin imports
This commit is contained in:
@@ -49,6 +49,6 @@ async def make_query_analyzer(conn: SearchConnection) -> AbstractQueryAnalyzer:
|
|||||||
log().comment(f"No tokenizer named '{name}' available. Database not set up properly.")
|
log().comment(f"No tokenizer named '{name}' available. Database not set up properly.")
|
||||||
raise RuntimeError('Tokenizer not found')
|
raise RuntimeError('Tokenizer not found')
|
||||||
|
|
||||||
module = importlib.import_module(f'nominatim.api.search.{name}_tokenizer')
|
module = importlib.import_module(f'nominatim_api.api.search.{name}_tokenizer')
|
||||||
|
|
||||||
return cast(AbstractQueryAnalyzer, await module.create_query_analyzer(conn))
|
return cast(AbstractQueryAnalyzer, await module.create_query_analyzer(conn))
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ Path settings for extra data used by Nominatim.
|
|||||||
"""
|
"""
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
PHPLIB_DIR = (Path(__file__) / '..' / '..' / '..' / 'lib-php').resolve()
|
PHPLIB_DIR = None
|
||||||
SQLLIB_DIR = (Path(__file__) / '..' / '..' / '..' / 'lib-sql').resolve()
|
SQLLIB_DIR = (Path(__file__) / '..' / '..' / '..' / 'lib-sql').resolve()
|
||||||
DATA_DIR = (Path(__file__) / '..' / '..' / '..' / 'data').resolve()
|
DATA_DIR = (Path(__file__) / '..' / '..' / '..' / 'data').resolve()
|
||||||
CONFIG_DIR = (Path(__file__) / '..' / '..' / '..' / 'settings').resolve()
|
CONFIG_DIR = (Path(__file__) / '..' / '..' / '..' / 'settings').resolve()
|
||||||
|
|||||||
@@ -180,7 +180,7 @@ class AdminServe:
|
|||||||
else:
|
else:
|
||||||
port = 8088
|
port = 8088
|
||||||
|
|
||||||
server_module = importlib.import_module(f'nominatim.server.{args.engine}.server')
|
server_module = importlib.import_module(f'nominatim_db.server.{args.engine}.server')
|
||||||
|
|
||||||
app = server_module.get_application(args.project_dir)
|
app = server_module.get_application(args.project_dir)
|
||||||
uvicorn.run(app, host=host, port=port)
|
uvicorn.run(app, host=host, port=port)
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ def _import_tokenizer(name: str) -> TokenizerModule:
|
|||||||
"Check the setting of NOMINATIM_TOKENIZER.", name)
|
"Check the setting of NOMINATIM_TOKENIZER.", name)
|
||||||
raise UsageError('Tokenizer not found')
|
raise UsageError('Tokenizer not found')
|
||||||
|
|
||||||
return importlib.import_module('nominatim.tokenizer.' + name + '_tokenizer')
|
return importlib.import_module('nominatim_db.tokenizer.' + name + '_tokenizer')
|
||||||
|
|
||||||
|
|
||||||
def create_tokenizer(config: Configuration, init_db: bool = True,
|
def create_tokenizer(config: Configuration, init_db: bool = True,
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ class TokenAnalyzerRule:
|
|||||||
raise UsageError("'analyzer' parameter needs to be simple string")
|
raise UsageError("'analyzer' parameter needs to be simple string")
|
||||||
|
|
||||||
self._analysis_mod: AnalysisModule = \
|
self._analysis_mod: AnalysisModule = \
|
||||||
config.load_plugin_module(analyzer_name, 'nominatim.tokenizer.token_analysis')
|
config.load_plugin_module(analyzer_name, 'nominatim_db.tokenizer.token_analysis')
|
||||||
|
|
||||||
self.config = self._analysis_mod.configure(rules, normalizer,
|
self.config = self._analysis_mod.configure(rules, normalizer,
|
||||||
transliterator)
|
transliterator)
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ class PlaceSanitizer:
|
|||||||
raise UsageError("'step' attribute must be a simple string.")
|
raise UsageError("'step' attribute must be a simple string.")
|
||||||
|
|
||||||
module: SanitizerHandler = \
|
module: SanitizerHandler = \
|
||||||
config.load_plugin_module(func['step'], 'nominatim.tokenizer.sanitizers')
|
config.load_plugin_module(func['step'], 'nominatim_db.tokenizer.sanitizers')
|
||||||
|
|
||||||
self.handlers.append(module.create(SanitizerConfig(func)))
|
self.handlers.append(module.create(SanitizerConfig(func)))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user