question: private boolean moveIndexFiles ( Directory tmpIdxDir , Directory indexDir ) { if ( LOG . isDebugEnabled ( ) ) { try { LOG . info ( "From dir files:" + Arrays . asList ( tmpIdxDir . listAll ( ) ) ) ; LOG . info ( "To dir files:" + Arrays . asList ( indexDir . listAll ( ) ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } String segmentsFile = null ; for ( Map < String , Object > f : filesDownloaded ) { String fname = ( String ) f . get ( NAME ) ; if ( fname . startsWith ( "segments_" ) ) { segmentsFile = fname ; continue ; } if ( ! moveAFile ( tmpIdxDir , indexDir , fname ) ) return false ; } if ( segmentsFile != null ) { if ( ! moveAFile ( tmpIdxDir , indexDir , segmentsFile ) ) return false ; } return true ; }
target:  Copy all index files from the temp index dir to the actual index. The segments_N file is copied last.