changeset 917:772c4c8db164 storage-ng

fix optimize_index to accept a tmp param
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sun, 02 Oct 2011 17:08:23 +0200
parents ac600982e40a
children 764f209d1eae
files MoinMoin/storage/middleware/indexing.py
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/storage/middleware/indexing.py	Sun Oct 02 16:34:13 2011 +0200
+++ b/MoinMoin/storage/middleware/indexing.py	Sun Oct 02 17:08:23 2011 +0200
@@ -529,12 +529,14 @@
         """
         # TODO
 
-    def optimize_index(self):
+    def optimize_index(self, tmp=False):
         """
         Optimize whoosh index.
         """
-        for name in self.ix:
-            self.ix[name].optimize()
+        index_dir = self.index_dir_tmp if tmp else self.index_dir
+        for name in INDEXES:
+            ix = open_dir(index_dir, indexname=name)
+            ix.optimize()
 
     def get_schema(self, all_revs=False):
         # XXX keep this as is for now, but later just give the index name as param