* we need to override the MergeScheduler to handle background errors, and a new instance needs to be created for each
* new IndexWriter.
* Also each new IndexWriter needs a new MergePolicy.
*/
private IndexWriter createNewIndexWriter() throws IOException {
LogByteSizeMergePolicy newMergePolicy = indexParameters.getNewMergePolicy(); //TODO make it possible to configure a different policy?
writerConfig.setMergePolicy( newMergePolicy );
MergeScheduler mergeScheduler = new ConcurrentMergeScheduler( this.errorHandler, this.indexName );
writerConfig.setMergeScheduler( mergeScheduler );
return new IndexWriter( directoryProvider.getDirectory(), writerConfig );
}