X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/c26ab6ee15974c1133a6d08c459b51199185f25f..dbb6eb3883a5f5e371f4bf7c89e74326feca0fd1:/apps/catalogue/models.py?ds=sidebyside diff --git a/apps/catalogue/models.py b/apps/catalogue/models.py index 556a8a1b8..ea09c048f 100644 --- a/apps/catalogue/models.py +++ b/apps/catalogue/models.py @@ -1087,9 +1087,11 @@ post_save.connect(_post_save_handler) @django.dispatch.receiver(post_delete, sender=Book) def _remove_book_from_index_handler(sender, instance, **kwargs): """ remove the book from search index, when it is deleted.""" + search.JVM.attachCurrentThread() idx = search.Index() idx.open(timeout=10000) # 10 seconds timeout. try: idx.remove_book(instance) + idx.index_tags() finally: idx.close()