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, new DefaultZoieVersionFactory());
try
{
Directory dir = srcDirMgr.getDirectory();
reader=IndexReader.open(dir,true);
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, new DefaultZoieVersionFactory());
Directory targetDir = targetDirMgr.getDirectory(true);
IndexWriter writer = null;
try