I honestly don't understand what DWPT pool has to do with IndexWriterConfig
instances not being reusable for new IndexWriter instances. If you have the
need to open a new IndexWriter with the same configuration as the one you
used before, why not save the original config as the template, then
We've removed IndexWriterConfig.clone as of 4.9:
https://issues.apache.org/jira/browse/LUCENE-5708
Cloning of those complex / expert classes was buggy and too hairy to get right.
You just have to make a new IWC every time you make an IW.
Mike McCandless
http://blog.mikemccandless.com
On
I think what you suggest probably will work, and I appreciate that. What I
am a little concerned about is if Indexwriterconfig is completely stateless
or not, meaning if i clone from the very original Indexwriterconfig, will I
lose some info from the breakpoint? Maybe I don't need worry about it,
IWC.clone is/was buggy ... just stop calling it and make a new IWC
from scratch each time in your application.
Mike McCandless
http://blog.mikemccandless.com
On Tue, Aug 12, 2014 at 8:37 AM, Sheng sheng...@gmail.com wrote:
I think what you suggest probably will work, and I appreciate that.
I tried to create a clone of indexwriteconfig with
indexWriterConfig.clone() for re-creating a new indexwriter, but I then I
got this very annoying illegalstateexception: clone this object before it
is used. Why does this exception happen, and how can I get around it?
Thanks!
Looks like you have to clone it prior to using with any IndexWriter
instances.
On Mon, Aug 11, 2014 at 2:49 PM, Sheng sheng...@gmail.com wrote:
I tried to create a clone of indexwriteconfig with
indexWriterConfig.clone() for re-creating a new indexwriter, but I then I
got this very annoying
So the indexWriterConfig.clone() failed at this step:
clone.indexerThreadPool = indexerThreadPool
http://grepcode.com/file/repo1.maven.org/maven2/org.apache.lucene/lucene-core/4.7.0/org/apache/lucene/index/LiveIndexWriterConfig.java#LiveIndexWriterConfig.0indexerThreadPool
.clone
I only have the source to 4.6.1, but if you look at the constructor of
IndexWriter there, it looks like this:
public IndexWriter(Directory d, IndexWriterConfig conf) throws
IOException {
conf.setIndexWriter(this); // prevent reuse by other instances
The setter throws an exception if the
From src code of DocumentsWriterPerThreadPool, the variable
numThreadStatesActive seems to be always increasing, which explains why
asserting on numThreadStatesActive == 0 before cloning this object
fails. So what should be the most appropriate way of re-opening an
indexwriter if what you have are