]> git.openstreetmap.org Git - nominatim.git/commitdiff
simplify analyse function
authorSarah Hoffmann <lonvia@denofr.de>
Mon, 12 Jul 2021 12:47:50 +0000 (14:47 +0200)
committerSarah Hoffmann <lonvia@denofr.de>
Mon, 12 Jul 2021 12:47:50 +0000 (14:47 +0200)
nominatim/indexer/indexer.py

index 5ab0eac3dca5701562085ffecdce652e110f9cfd..76883500b7a23469b1332d0ca0305551349b4dc6 100644 (file)
@@ -92,7 +92,7 @@ class Indexer:
 
 
     def index_full(self, analyse=True):
-        """ Index the complete database. This will first index boudnaries
+        """ Index the complete database. This will first index boundaries
             followed by all other objects. When `analyse` is True, then the
             database will be analysed at the appropriate places to
             ensure that database statistics are updated.
@@ -100,13 +100,10 @@ class Indexer:
         with connect(self.dsn) as conn:
             conn.autocommit = True
 
-            if analyse:
-                def _analyze():
+            def _analyze():
+                if analyse:
                     with conn.cursor() as cur:
                         cur.execute('ANALYZE')
-            else:
-                def _analyze():
-                    pass
 
             self.index_by_rank(0, 4)
             _analyze()