* @param indexDir The directory where to write a new index
* @return the created FSDirectory
* @throws IOException
*/
public static FSDirectory createFSIndex(File indexDir, Properties dirConfiguration) throws IOException {
LockFactory lockFactory = createLockFactory(indexDir, dirConfiguration);
FSDirectory fsDirectory = FSDirectory.open( indexDir, null );
// must use the setter (instead of using the constructor) to set the lockFactory, or Lucene will
// throw an exception if it's different than a previous setting.
fsDirectory.setLockFactory( lockFactory );
if ( ! IndexReader.indexExists( fsDirectory ) ) {