]> git.openstreetmap.org Git - nominatim.git/commitdiff
test: rerun indexing after updates until really all is done
authorSarah Hoffmann <lonvia@denofr.de>
Sat, 11 Mar 2017 16:09:14 +0000 (17:09 +0100)
committerSarah Hoffmann <lonvia@denofr.de>
Sat, 11 Mar 2017 16:09:14 +0000 (17:09 +0100)
There are caess where indexing needs to be done a second round
because related objects need to be updated.

test/bdd/steps/db_ops.py

index fa66cd4df260765ce9d44ef676bc556a3a319ec1..869cf829825fce1212ffea6acc437a1cf3266d53 100644 (file)
@@ -243,7 +243,14 @@ def update_place_table(context):
         col.db_insert(cur)
 
     context.db.commit()
-    context.nominatim.run_update_script('index')
+
+    while True:
+        context.nominatim.run_update_script('index')
+
+        cur = context.db.cursor()
+        cur.execute("SELECT 'a' FROM placex WHERE indexed_status != 0 LIMIT 1")
+        if cur.rowcount == 0:
+            break
 
 @when("marking for delete (?P<oids>.*)")
 def delete_places(context, oids):
@@ -254,7 +261,14 @@ def delete_places(context, oids):
         where, params = NominatimID(oid).table_select()
         cur.execute("DELETE FROM place WHERE " + where, params)
     context.db.commit()
-    context.nominatim.run_update_script('index')
+
+    while True:
+        context.nominatim.run_update_script('index')
+
+        cur = context.db.cursor()
+        cur.execute("SELECT 'a' FROM placex WHERE indexed_status != 0 LIMIT 1")
+        if cur.rowcount == 0:
+            break
 
 @then("placex contains(?P<exact> exactly)?")
 def check_placex_contents(context, exact):