Matt Chaput  committed 2275d1c

Don't queue an empty doc buffer in MpWriter. Fixes issue #245.

  • Participants
  • Parent commits 9db6fa3

Comments (0)

Files changed (2)

File src/whoosh/filedb/

     def _commit(self, mergetype, optimize, merge):
             # Index the remaining documents in the doc buffer
-            self._enqueue()
+            if self.docbuffer:
+                self._enqueue()
             # Tell the tasks to finish
             for task in self.tasks:

File tests/

                     assert word in hit["a"].split()
+def test_batchsize_eq_doccount():
+    from whoosh.filedb.multiproc import MpWriter
+    schema = fields.Schema(a=fields.KEYWORD(stored=True))
+    with TempIndex(schema) as ix:
+        with ix.writer(procs=4, batchsize=10) as w:
+            for i in xrange(10):
+                w.add_document(a=u(str(i)))