calculate time in merging lcuene indexes
I am merging lucene indexes with the help of java programs .Merging of
indexing is being done fine but i also want to display the waiting time to
merge the indexes .So is there any ,method
to calculate the time taken to merge the indexes or suggest any alternate
actually i want to show the progress bar which will show the approximate
time taken to merge the indexes. For merging the index i am using the
following code.
try{
File INDEX_DIR= new File("D:\\merge lucene\\abc\\");
INDEX_DIR.mkdir();
File indexDir = new File("D:\\merge lucene\\abc\\");
Directory indexes[] = new Directory[indexDir.list().length];
IndexWriter writer = new IndexWriter(
FSDirectory.open(INDEX_DIR),
new SimpleAnalyzer(),true,
IndexWriter.MaxFieldLength.LIMITED);
indexes[0] = FSDirectory.open(indexDir);
writer.addIndexes(indexes[0]);
File indexDir1 = new File("D:\\merge lucene\\def\\");
Directory indexes1[] = new Directory[indexDir1.list().length];
indexes1[0] = FSDirectory.open(indexDir1);
writer.addIndexes(indexes1[0]);
writer.optimize();
writer.close();
System.out.println("index merged");
}
catch(Exception ex){System.out.println("exception here"+ex);}
}
No comments:
Post a Comment