commit on close of reusable inedxer
authorMarcin Koziej <marcin.koziej@nowoczesnapolska.org.pl>
Tue, 31 Jan 2012 13:06:11 +0000 (14:06 +0100)
committerMarcin Koziej <marcin.koziej@nowoczesnapolska.org.pl>
Tue, 31 Jan 2012 13:06:11 +0000 (14:06 +0100)
apps/search/index.py

index 12554d2..97145d3 100644 (file)
@@ -554,7 +554,7 @@ class ReusableIndex(Index):
     index = None
 
     def open(self, analyzer=None, threads=4):
     index = None
 
     def open(self, analyzer=None, threads=4):
-        if ReusableIndex.index is not None:
+        if ReusableIndex.index:
             self.index = ReusableIndex.index
         else:
             print("opening index")
             self.index = ReusableIndex.index
         else:
             print("opening index")
@@ -568,13 +568,15 @@ class ReusableIndex(Index):
 
     @staticmethod
     def close_reusable():
 
     @staticmethod
     def close_reusable():
-        if ReusableIndex.index is not None:
+        if ReusableIndex.index:
+            print("closing index")
             ReusableIndex.index.optimize()
             ReusableIndex.index.close()
             ReusableIndex.index = None
 
     def close(self):
             ReusableIndex.index.optimize()
             ReusableIndex.index.close()
             ReusableIndex.index = None
 
     def close(self):
-        pass
+        if ReusableIndex.index:
+            ReusableIndex.index.commit()
 
 
 class JoinSearch(object):
 
 
 class JoinSearch(object):