diff --git a/apps/storm/whoosh_cn_backend.py b/apps/storm/whoosh_cn_backend.py index a3a657c..58f5024 100644 --- a/apps/storm/whoosh_cn_backend.py +++ b/apps/storm/whoosh_cn_backend.py @@ -121,14 +121,13 @@ def setup(self): self.content_field_name, self.schema = self.build_schema(connections[self.connection_alias].get_unified_index().all_searchfields()) self.parser = QueryParser(self.content_field_name, schema=self.schema) - if new_index is True: - self.index = self.storage.create_index(self.schema) - else: + if not new_index: try: self.index = self.storage.open_index(schema=self.schema) - except index.EmptyIndexError: - self.index = self.storage.create_index(self.schema) + except BaseException as e: + print("OpenIndexError: {}".format(e)) + self.index = self.storage.create_index(self.schema) self.setup_complete = True def build_schema(self, fields):