Skip to content

Commit

Permalink
fix-issue-stormsha#4
Browse files Browse the repository at this point in the history
  • Loading branch information
hope-999 committed May 17, 2020
1 parent 84691d9 commit 4e02b63
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions apps/storm/whoosh_cn_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 4e02b63

Please sign in to comment.