import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
-import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
try {
mon.subTask("Start index write");
- createDirectory(indexPath);
+ Files.createDirectories(indexPath.toPath());
directory.set(FSDirectory.open(indexPath));
IndexWriterConfig conf = new IndexWriterConfig(Version.LUCENE_4_9, Queries.getAnalyzer()).setOpenMode(OpenMode.CREATE);
return path;
}
- private static void createDirectory(File path) throws IOException {
- Path p = path.toPath();
- if (Files.exists(p) && !Files.isDirectory(p))
- throw new IOException("Could not create index directory " + path + ", a file by that name already exists");
- Files.createDirectories(p);
- }
-
File getIndexPath() {
return indexPath;
}