change workshop form title
[wolnelektury.git] / src / search / index.py
index ffad257..7dfe6ef 100644 (file)
@@ -139,7 +139,6 @@ class Index(SolrIndex):
         else:
             return False
 
         else:
             return False
 
-    # WTF
     def index_tags(self, *tags, **kw):
         """
         Re-index global tag list.
     def index_tags(self, *tags, **kw):
         """
         Re-index global tag list.
@@ -828,7 +827,11 @@ class Search(SolrIndex):
                 idx += 1
 
         except IOError, e:
                 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()
             return []
         finally:
             snippets.close()