]> git.openstreetmap.org Git - nominatim.git/commitdiff
add actual removal of housenumber tokens
authorSarah Hoffmann <lonvia@denofr.de>
Thu, 20 Jan 2022 19:18:15 +0000 (20:18 +0100)
committerSarah Hoffmann <lonvia@denofr.de>
Thu, 20 Jan 2022 19:18:15 +0000 (20:18 +0100)
nominatim/tokenizer/icu_tokenizer.py

index da07897bd3e28a4ee638c92b01bb43141c7d4c5b..0841300a9b92421ac130ab827ff2a9935af507ed 100644 (file)
@@ -134,15 +134,21 @@ class LegacyICUTokenizer(AbstractTokenizer):
                 for row in cur:
                     for hnr in row[0].split(';'):
                         candidates.pop(hnr, None)
                 for row in cur:
                     for hnr in row[0].split(';'):
                         candidates.pop(hnr, None)
-        LOG.info("There are %s outdated housenumbers.", len(candidates))
+            LOG.info("There are %s outdated housenumbers.", len(candidates))
+            if candidates:
+                with conn.cursor() as cur:
+                    cur.execute("""DELETE FROM word WHERE word_id = any(%s)""",
+                                (list(candidates.values()), ))
+                conn.commit()
+
 
 
     def update_word_tokens(self):
         """ Remove unused tokens.
         """
 
 
     def update_word_tokens(self):
         """ Remove unused tokens.
         """
-        LOG.info("Cleaning up housenumber tokens.")
+        LOG.warn("Cleaning up housenumber tokens.")
         self._cleanup_housenumbers()
         self._cleanup_housenumbers()
-        LOG.info("Tokenizer house-keeping done.")
+        LOG.warn("Tokenizer house-keeping done.")
 
 
     def name_analyzer(self):
 
 
     def name_analyzer(self):