X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/4fea8503c1f680b7e6942dfae6f0e7a8589e47ea..3b73241bfb6fa47f8b7c1d6629a3e537d34aad3c:/apps/catalogue/models.py diff --git a/apps/catalogue/models.py b/apps/catalogue/models.py index 5846f5343..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.Index() as idx: + idx = search.ReusableIndex() + idx.open() + try: idx.index_book(self) + finally: + idx.close() @classmethod def from_xml_file(cls, xml_file, **kwargs):