public void commit ( ) { if ( directory == null ) return ; try { if ( reader != null ) reader . close ( ) ; // it turns out that IndexWriter.optimize actually slows // searches down, because it invalidates the cache. therefore // not calling it any more. // http://www.searchworkings.org/blog/-/blogs/uwe-says%3A-is-your-reader-atomic // iwriter.optimize(); iwriter . commit ( ) ; openSearchers ( ) ; } catch ( IOException e ) { throw new DukeException ( e ) ; } }
Flushes all changes to disk .