X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/5c3f2f665243a32510f8097bf6c0582fc14d2fd3..4d5f62cd29ea6056605de06356fad641100f426b:/apps/catalogue/models.py?ds=sidebyside diff --git a/apps/catalogue/models.py b/apps/catalogue/models.py index 3db237e3c..0863d5b66 100644 --- a/apps/catalogue/models.py +++ b/apps/catalogue/models.py @@ -626,8 +626,12 @@ class Book(models.Model): return result.wait() def search_index(self): - with search.ReusableIndex() as idx: + idx = search.ReusableIndex() + idx.open() + try: idx.index_book(self) + finally: + idx.close() @classmethod def from_xml_file(cls, xml_file, **kwargs):