* @throws java.io.IOException if an error
*/
public static FSDirectory createFSIndex(File indexDir, Properties properties) throws IOException {
LockFactory lockFactory = createLockFactory( indexDir, properties );
FSDirectoryType fsDirectoryType = FSDirectoryType.getType( properties );
FSDirectory fsDirectory = fsDirectoryType.getDirectory( 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 );
log.debugf( "Initialize index: '%s'", indexDir.getAbsolutePath() );
initializeIndexIfNeeded( fsDirectory );
return fsDirectory;
}