Commits

Thomas Waldmann  committed b8652b8

simplify creation of whoosh's index writer for whoosh >2.3.2

  • Participants
  • Parent commits 792712f

Comments (0)

Files changed (1)

File MoinMoin/storage/middleware/indexing.py

 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
         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)