]> git.openstreetmap.org Git - nominatim.git/commitdiff
ICU: add an index over word_ids
authorSarah Hoffmann <lonvia@denofr.de>
Mon, 25 Oct 2021 19:33:27 +0000 (21:33 +0200)
committerSarah Hoffmann <lonvia@denofr.de>
Mon, 25 Oct 2021 19:33:27 +0000 (21:33 +0200)
Needed for keyword lookup in the details response.

lib-sql/tokenizer/legacy_tokenizer_indices.sql
nominatim/tokenizer/icu_tokenizer.py

index b21f29d7fc3b72bc0c7f00ed9e87da161c2822fc..d653a26dfa84c356996cd9adbf051e1d99b1f07a 100644 (file)
@@ -1,2 +1,3 @@
+-- Required for details lookup.
 CREATE INDEX IF NOT EXISTS idx_word_word_id
   ON word USING BTREE (word_id) {{db.tablespace.search_index}};
 CREATE INDEX IF NOT EXISTS idx_word_word_id
   ON word USING BTREE (word_id) {{db.tablespace.search_index}};
index 2af0bcb257ad214f3e67621a7ac1aaa83b7092d1..e7ee57ad197b5879187a5070a97c07e544c5f8f1 100644 (file)
@@ -67,10 +67,13 @@ class LegacyICUTokenizer(AbstractTokenizer):
             self.term_normalization = get_property(conn, DBCFG_TERM_NORMALIZATION)
 
 
             self.term_normalization = get_property(conn, DBCFG_TERM_NORMALIZATION)
 
 
-    def finalize_import(self, _):
+    def finalize_import(self, config):
         """ Do any required postprocessing to make the tokenizer data ready
             for use.
         """
         """ Do any required postprocessing to make the tokenizer data ready
             for use.
         """
+        with connect(self.dsn) as conn:
+            sqlp = SQLPreprocessor(conn, config)
+            sqlp.run_sql_file(conn, 'tokenizer/legacy_tokenizer_indices.sql')
 
 
     def update_sql_functions(self, config):
 
 
     def update_sql_functions(self, config):