From 2b110a246aad2a6a8c724abfb9a54ed53c466c39 Mon Sep 17 00:00:00 2001 From: Marcin Koziej Date: Tue, 31 Jan 2012 14:06:11 +0100 Subject: [PATCH 1/1] commit on close of reusable inedxer --- apps/search/index.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/apps/search/index.py b/apps/search/index.py index 12554d2be..97145d340 100644 --- a/apps/search/index.py +++ b/apps/search/index.py @@ -554,7 +554,7 @@ class ReusableIndex(Index): 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") @@ -568,13 +568,15 @@ class ReusableIndex(Index): @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): - pass + if ReusableIndex.index: + ReusableIndex.index.commit() class JoinSearch(object): -- 2.20.1