Hi every body:

  I need to know how to merge an index into another.

  I have a master index whose another indexes are added to it from others
nodes . I want to merge indexes from the

others nodes to master index, I made this method:

     public void merge(String MasterIndexDir, String IndexToMerge) {

           FSDirectory fsDir;
           try {
               fsDir = FSDirectory.getDirectory(IndexDir, false);
               IndexReader indexToMerge = IndexReader.open(IndexToMerge);
               AnalyzerHandler analyzer = new AnalyzerHandler();
               IndexWriter fsWriter = new IndexWriter(fsDir,
analyzer.getAnalyzer(), false);

               fsWriter.addIndexes(new IndexReader[] {indexToMerge});
               fsWriter.close();

           } catch (IOException e) {
               System.err.println(e.getMessage());
               e.printStackTrace();
           }


   }

But with this method I get the following exception:

Lock obtain timed out: [EMAIL PROTECTED]:\DOCUME~1\a\LOCALS~1\Temp\lucene-
f9488d465badf2bf80c713184c580f65-write.lock
java.io.IOException: Lock obtain timed out: [EMAIL PROTECTED]
:\DOCUME~1\aromero\LOCALS~1\Temp\lucene-
f9488d465badf2bf80c713184c580f65-write.lock
   at org.apache.lucene.store.Lock.obtain(Lock.java:58)
   at org.apache.lucene.index.IndexWriter.<init>(IndexWriter.java:223)
   at org.apache.lucene.index.IndexWriter.<init>(IndexWriter.java:213)
   at cu.co.cenatav.kernel.indexing.MergeIndexes.merge(MergeIndexes.java
:18)
   at cu.co.cenatav.kernel.indexing.MergeIndexes.main(MergeIndexes.java:36)

Could you help me ???
I don't know why this is happening ???

Sorry for my english.

Reply via email to