int numReplicas = Integer.parseInt(args[2]);
System.out.println("source index: " + srcIndex.getAbsolutePath());
System.out.println("target index: " + targetIndex.getAbsolutePath());
System.out.println("num replications: " + numReplicas);
IndexReader reader = null;
DirectoryManager srcDirMgr = new DefaultDirectoryManager(srcIndex);
try {
Directory dir = srcDirMgr.getDirectory();
reader = DirectoryReader.open(dir);
System.out.println("source index, numdocs: " + reader.numDocs());
} catch (IOException e) {
e.printStackTrace();
} finally {
if (reader != null) {
reader.close();
}
reader = null;
}
DirectoryManager targetDirMgr = new DefaultDirectoryManager(targetIndex);
Directory targetDir = targetDirMgr.getDirectory(true);
IndexWriter writer = null;
try {
IndexWriterConfig idxWriterConf = new IndexWriterConfig(Version.LUCENE_43,
new StandardAnalyzer(Version.LUCENE_43));