Commit 744bad2d authored by Michal Čihař's avatar Michal Čihař

Ignore io errors when deleting unit

The index might be non existing and we do not want to fail on it.

Fixes rb#498, rb#499
Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent 1c133831
......@@ -303,7 +303,10 @@ def more_like(pk, source, top=5):
def clean_search_unit(pk, lang):
"""Cleanups search index on unit deletion."""
index = get_target_index(lang)
index.writer().delete_by_term('pk', pk)
index = get_source_index()
index.writer().delete_by_term('pk', pk)
try:
index = get_target_index(lang)
index.writer().delete_by_term('pk', pk)
index = get_source_index()
index.writer().delete_by_term('pk', pk)
except IOError:
return
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment