mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-15 10:57:58 +00:00
introduce name analyzer
The name analyzer is the actual work horse of the tokenizer. It is instantiated on a thread-base and provides all functions for analysing names and queries.
This commit is contained in:
@@ -23,3 +23,30 @@ class DummyTokenizer:
|
||||
def init_from_project(self):
|
||||
assert self.init_state == None
|
||||
self.init_state = "loaded"
|
||||
|
||||
|
||||
def name_analyzer(self):
|
||||
return DummyNameAnalyzer()
|
||||
|
||||
|
||||
class DummyNameAnalyzer:
|
||||
|
||||
def __enter__(self):
|
||||
return self
|
||||
|
||||
def __exit__(self, exc_type, exc_value, traceback):
|
||||
self.close()
|
||||
|
||||
|
||||
def close(self):
|
||||
""" Free all resources used by the analyzer.
|
||||
"""
|
||||
pass
|
||||
|
||||
def process_place(self, place):
|
||||
""" Determine tokenizer information about the given place.
|
||||
|
||||
Returns a JSON-serialisable structure that will be handed into
|
||||
the database via the token_info field.
|
||||
"""
|
||||
return {}
|
||||
|
||||
@@ -29,6 +29,7 @@ class IndexerTestDB:
|
||||
partition SMALLINT,
|
||||
admin_level SMALLINT,
|
||||
address HSTORE,
|
||||
token_info JSONB,
|
||||
geometry_sector INTEGER)""")
|
||||
cur.execute("""CREATE TABLE location_property_osmline (
|
||||
place_id BIGINT,
|
||||
|
||||
Reference in New Issue
Block a user