X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/3b73241bfb6fa47f8b7c1d6629a3e537d34aad3c..cdf0ea700156d13cd27a670d9363d92ebaffa93f:/apps/catalogue/models.py diff --git a/apps/catalogue/models.py b/apps/catalogue/models.py index 0863d5b66..1a2e8f86f 100644 --- a/apps/catalogue/models.py +++ b/apps/catalogue/models.py @@ -626,7 +626,14 @@ class Book(models.Model): return result.wait() def search_index(self): - idx = search.ReusableIndex() + if settings.SEARCH_INDEX_PARALLEL: + if instance(settings.SEARCH_INDEX_PARALLEL, int): + idx = search.ReusableIndex(threads=4) + else: + idx = search.ReusableIndex() + else: + idx = search.Index() + idx.open() try: idx.index_book(self)