public static void updateTimestamp( Directory directory, Date timestamp ) throws IOException { synchronized ( directory ) { Date currentTimestamp = getTimestamp( directory ); if ( timestamp != null && ( currentTimestamp == null || !currentTimestamp.equals( timestamp ) ) ) { deleteTimestamp( directory ); IndexOutput io = directory.createOutput( TIMESTAMP_FILE, IOContext.DEFAULT ); try { io.writeLong( timestamp.getTime() ); } finally { close( io ); } } } }
public static void updateTimestamp( Directory directory, Date timestamp ) throws IOException { synchronized ( directory ) { Date currentTimestamp = getTimestamp( directory ); if ( timestamp != null && ( currentTimestamp == null || !currentTimestamp.equals( timestamp ) ) ) { deleteTimestamp( directory ); IndexOutput io = directory.createOutput( TIMESTAMP_FILE, IOContext.DEFAULT ); try { io.writeLong( timestamp.getTime() ); } finally { close( io ); } } } }
public static void updateTimestamp( Directory directory, Date timestamp ) throws IOException { synchronized ( directory ) { Date currentTimestamp = getTimestamp( directory ); if ( timestamp != null && ( currentTimestamp == null || !currentTimestamp.equals( timestamp ) ) ) { deleteTimestamp( directory ); IndexOutput io = directory.createOutput( TIMESTAMP_FILE, IOContext.DEFAULT); try { io.writeLong( timestamp.getTime() ); io.flush(); } finally { close( io ); } } } }
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 ); }
Date mergedTimestamp = IndexUtils.getTimestamp( directory );
Date mergedTimestamp = IndexUtils.getTimestamp( directory );
Date mergedTimestamp = IndexUtils.getTimestamp( directory );
public synchronized void replace( Directory directory ) throws IOException { final Date ts = IndexUtils.getTimestamp( directory ); closeReaders(); deleteIndexFiles( false ); IndexUtils.copyDirectory( directory, indexDirectory ); openAndWarmup(); // reclaim the index as mine storeDescriptor(); rebuildGroups(); updateTimestamp( true, ts ); optimize(); }
timestamp = IndexUtils.getTimestamp( indexDirectory );
timestamp = IndexUtils.getTimestamp( indexDirectory );
timestamp = IndexUtils.getTimestamp( indexDirectory );
public synchronized void replace( Directory directory, Set<String> allGroups, Set<String> rootGroups ) throws IOException { final Date ts = IndexUtils.getTimestamp( directory ); closeReaders(); deleteIndexFiles( false ); IndexUtils.copyDirectory( directory, indexDirectory ); openAndWarmup(); // reclaim the index as mine storeDescriptor(); if ( allGroups == null && rootGroups == null ) { rebuildGroups(); } else { if ( allGroups != null ) { setAllGroups( allGroups ); } if ( rootGroups != null ) { setRootGroups( rootGroups ); } } updateTimestamp( true, ts ); optimize(); }
public synchronized void replace( Directory directory, Set<String> allGroups, Set<String> rootGroups ) throws IOException { final Date ts = IndexUtils.getTimestamp( directory ); closeReaders(); deleteIndexFiles( false ); IndexUtils.copyDirectory( directory, indexDirectory ); openAndWarmup(); // reclaim the index as mine storeDescriptor(); if ( allGroups == null && rootGroups == null ) { rebuildGroups(); } else { if ( allGroups != null ) { setAllGroups( allGroups ); } if ( rootGroups != null ) { setRootGroups( rootGroups ); } } updateTimestamp( true, ts ); optimize(); }