paralell indexing
authorMarcin Koziej <marcin.koziej@nowoczesnapolska.org.pl>
Thu, 10 Nov 2011 15:57:44 +0000 (16:57 +0100)
committerMarcin Koziej <marcin.koziej@nowoczesnapolska.org.pl>
Tue, 15 Nov 2011 13:24:23 +0000 (14:24 +0100)
apps/catalogue/models.py
wolnelektury/settings.py

index 0863d5b..1a2e8f8 100644 (file)
@@ -626,7 +626,14 @@ class Book(models.Model):
         return result.wait()
 
     def search_index(self):
         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)
         idx.open()
         try:
             idx.index_book(self)
index c0baf99..ca06784 100644 (file)
@@ -234,6 +234,7 @@ NO_BUILD_TXT = False
 NO_BUILD_PDF = True
 NO_BUILD_MOBI = True
 NO_SEARCH_INDEX = 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'
 
 ALL_EPUB_ZIP = 'wolnelektury_pl_epub'
 ALL_PDF_ZIP = 'wolnelektury_pl_pdf'