From: Marcin Koziej Date: Thu, 10 Nov 2011 15:57:44 +0000 (+0100) Subject: paralell indexing X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/cdf0ea700156d13cd27a670d9363d92ebaffa93f?ds=inline paralell indexing --- 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) diff --git a/wolnelektury/settings.py b/wolnelektury/settings.py index c0baf9990..ca0678455 100644 --- a/wolnelektury/settings.py +++ b/wolnelektury/settings.py @@ -234,6 +234,7 @@ NO_BUILD_TXT = False NO_BUILD_PDF = True NO_BUILD_MOBI = True NO_SEARCH_INDEX = False +SEARCH_INDEX_PARALLEL = False ALL_EPUB_ZIP = 'wolnelektury_pl_epub' ALL_PDF_ZIP = 'wolnelektury_pl_pdf'