BufferedWriter uses commit() in the __exit__() method instead of close()

Issue #401 resolved
Anonymous created an issue

Hello,

I use a BufferedWriter in a function in the following way:

with whoosh.writing.BufferedWriter(myindex, limit=100, writerargs={'limitmb': 512}, commitargs={'optimize': True}) as writer:
    ...

and I call this function several times. Unfortunately, I get a whoosh.index.LockError for the second call.

Looking at the implementation of the BufferedWriter it apparently uses the inherited exit() method from IndexWriter which calls commit(). However, on a BufferedWriter one usually calls close(). After I added an exit() method which calls close() instead of commit() to the BufferedWriter all works fine.

Comments (1)

  1. Log in to comment