public static boolean copyFile( Directory source, Directory target, String name ) throws IOException { return copyFile( source, target, name, name ); }
public static boolean copyFile( Directory source, Directory target, String srcName, String targetName ) throws IOException { try { source.fileLength( srcName ); // instead of fileExists } catch ( FileNotFoundException | NoSuchFileException e ) { return false; } target.copyFrom( source, srcName, targetName, IOContext.DEFAULT ); return true; }
public static boolean copyFile( Directory source, Directory target, String srcName, String targetName ) throws IOException { try { source.fileLength( srcName ); // instead of fileExists } catch ( FileNotFoundException | NoSuchFileException e ) { return false; } target.copyFrom( source, srcName, targetName, IOContext.DEFAULT ); return true; }
public static void copyDirectory( Directory source, Directory target ) throws IOException { //FIXME: check if this copies too much, Lucene 4 has no filter for lucene files //Directory.copy( source, target, false ); for ( String file : source.listAll() ) { target.copyFrom( source, file, file, IOContext.DEFAULT ); } copyFile( source, target, IndexingContext.INDEX_UPDATER_PROPERTIES_FILE ); copyFile( source, target, IndexingContext.INDEX_PACKER_PROPERTIES_FILE ); Date ts = getTimestamp( source ); updateTimestamp( target, ts ); }
public static void copyDirectory( Directory source, Directory target ) throws IOException { //FIXME: check if this copies too much, Lucene 4 has no filter for lucene files //Directory.copy( source, target, false ); for ( String file : source.listAll() ) { target.copyFrom( source, file, file, IOContext.DEFAULT ); } copyFile( source, target, IndexingContext.INDEX_UPDATER_PROPERTIES_FILE ); copyFile( source, target, IndexingContext.INDEX_PACKER_PROPERTIES_FILE ); Date ts = getTimestamp( source ); updateTimestamp( target, ts ); }
public static void copyDirectory( Directory source, Directory target ) throws IOException { //FIXME: check if this copies too much, Lucene 4 has no filter for lucene files //Directory.copy( source, target, false ); for (String file : source.listAll()) { source.copy(target, file, file, IOContext.DEFAULT); } copyFile( source, target, IndexingContext.INDEX_UPDATER_PROPERTIES_FILE ); copyFile( source, target, IndexingContext.INDEX_PACKER_PROPERTIES_FILE ); Date ts = getTimestamp( source ); updateTimestamp( target, ts ); }