Your getting this error when you attempt to open an IndexWriter
when there is already a writer open on the index.
In addition to that issue, opening a new IndexWriter
is a very expensive operation. Even if you were to get it working (say synchronizing a block which opens, uses and then closes the IndexWriter
), this would likely be quite slow.
Instead, open one IndexWriter
, keep it open, and share it across each of the threads.