changeset 1336:b8652b85a5fa

simplify creation of whoosh's index writer for whoosh >2.3.2
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sat, 21 Apr 2012 20:04:20 +0200
parents 792712fe85e8
children 3b1de2b38587
files MoinMoin/storage/middleware/indexing.py
diffstat 1 files changed, 1 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/storage/middleware/indexing.py	Sat Apr 21 19:36:26 2012 +0200
+++ b/MoinMoin/storage/middleware/indexing.py	Sat Apr 21 20:04:20 2012 +0200
@@ -65,7 +65,6 @@
 from whoosh.fields import Schema, TEXT, ID, IDLIST, NUMERIC, DATETIME, KEYWORD, BOOLEAN
 from whoosh.index import open_dir, create_in, EmptyIndexError
 from whoosh.writing import AsyncWriter
-from whoosh.filedb.multiproc import MultiSegmentWriter
 from whoosh.qparser import QueryParser, MultifieldParser, RegexPlugin, \
                            PseudoFieldPlugin
 from whoosh.qparser import WordNode
@@ -422,13 +421,7 @@
         Note: mode == 'add' is faster but you need to make sure to not create duplicate
               documents in the index.
         """
-        if procs == 1:
-            # MultiSegmentWriter sometimes has issues and is pointless for procs == 1,
-            # so use the simple writer when --procs 1 is given:
-            writer = index.writer()
-        else:
-            writer = MultiSegmentWriter(index, procs, limitmb)
-        with writer as writer:
+        with index.writer(procs=procs, limitmb=limitmb) as writer:
             for mountpoint, revid in revids:
                 if mode in ['add', 'update', ]:
                     meta, data = self.backend.retrieve(mountpoint, revid)