X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/a31dc3ca0f28d89b0b18b9d4c857f64ac9488b7a..197f766eb06ca1aa6cc9ca6d8a348bb0450c26c6:/apps/search/index.py 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):