You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Patrick Kimber <ma...@gmail.com> on 2007/10/10 13:59:31 UTC

IndexMergeTool - Close indexes before merge?

Hi

The IndexMergeTool (see url below) creates a new index, the "mergedIndex".

Do the other indexes, "index1", "index2", etc, need to be closed
before performing the merge?
This is the same as asking if the indexes passed to
IndexWriter.addIndexes need to be closed before they are added to the
new index.

http://svn.apache.org/repos/asf/lucene/java/trunk/contrib/miscellaneous/src/java/org/apache/lucene/misc/IndexMergeTool.java

Thanks for your help,

Patrick

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: IndexMergeTool - Close indexes before merge?

Posted by Michael McCandless <lu...@mikemccandless.com>.
Yes, you should close the indices before adding them.  Both of the addIndexes*
methods that take Directory[] require that there are no writers changing the
index in those directories.

They do not acquire the write lock in those Directories, so it's up to your
application to ensure no writer changes the index while addIndexes is running. 

I'll update the javadocs with this caveat.  Thanks for pointing it out
Patrick!

Mike

"Patrick Kimber" <ma...@gmail.com> wrote:
> Hi
> 
> The IndexMergeTool (see url below) creates a new index, the
> "mergedIndex".
> 
> Do the other indexes, "index1", "index2", etc, need to be closed
> before performing the merge?
> This is the same as asking if the indexes passed to
> IndexWriter.addIndexes need to be closed before they are added to the
> new index.
> 
> http://svn.apache.org/repos/asf/lucene/java/trunk/contrib/miscellaneous/src/java/org/apache/lucene/misc/IndexMergeTool.java
> 
> Thanks for your help,
> 
> Patrick
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org