X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/ae60b2a3949e96357477cc04f90fd0873cee8a92..4ddb93217b0476206908c0f2b4a66989631bdef3:/src/search/index.py diff --git a/src/search/index.py b/src/search/index.py index ffad25788..7dfe6ef5a 100644 --- a/src/search/index.py +++ b/src/search/index.py @@ -139,7 +139,6 @@ class Index(SolrIndex): else: return False - # WTF def index_tags(self, *tags, **kw): """ Re-index global tag list. @@ -828,7 +827,11 @@ class Search(SolrIndex): idx += 1 except IOError, e: - log.error("Cannot open snippet file for book id = %d [rev=%s], %s" % (book_id, revision, e)) + book = catalogue.models.Book.objects.filter(id=book_id) + if not book: + log.error("Book does not exist for book id = %d" % book_id) + elif not book.get().children.exists(): + log.error("Cannot open snippet file for book id = %d [rev=%s], %s" % (book_id, revision, e)) return [] finally: snippets.close()