checkDirectory();
checkIndexLocking();
boolean exists = IndexReader.indexExists(getDirectory());
if( !exists && !create ) {
throw new LuceneIndexAccessException("The index doesn't exist for the specified directory. "+
"To allow the creation of the index, set the create property to true.");
}
IndexWriter writer = new IndexWriter(getDirectory(), getAnalyzer(), !exists);
setIndexWriterParameters(writer);
return new SimpleLuceneIndexWriter(writer);
} catch(IOException ex) {
throw new LuceneIndexAccessException("Error during creating the writer",ex);
}
}