public void optimize ( ) { Log . debug ( "Optimizing index" ) ; try { indexWriter . forceMerge ( 1 , true ) ; indexWriter . commit ( ) ; } catch ( IOException e ) { Log . error ( e , "Error while optimizing index" ) ; throw new RuntimeException ( e ) ; } }
Optimizes the index forcing merge segments leaving one single segment . This operation blocks until all merging completes .