use of org.apache.lucene.benchmark.byTask.utils.Config in project lucene-solr by apache.
the class OpenIndexTask method doLogic.
@Override
public int doLogic() throws IOException {
PerfRunData runData = getRunData();
Config config = runData.getConfig();
final IndexCommit ic;
if (commitUserData != null) {
ic = OpenReaderTask.findIndexCommit(runData.getDirectory(), commitUserData);
} else {
ic = null;
}
final IndexWriter writer = CreateIndexTask.configureWriter(config, runData, OpenMode.APPEND, ic);
runData.setIndexWriter(writer);
return 1;
}
use of org.apache.lucene.benchmark.byTask.utils.Config in project lucene-solr by apache.
the class TestPerfTasksParse method testParseExamples.
/** Test the parsing of example scripts **/
@SuppressWarnings("try")
public void testParseExamples() throws Exception {
// hackedy-hack-hack
boolean foundFiles = false;
final Path examplesDir = Paths.get(ConfLoader.class.getResource(".").toURI());
try (DirectoryStream<Path> stream = Files.newDirectoryStream(examplesDir, "*.alg")) {
for (Path path : stream) {
Config config = new Config(Files.newBufferedReader(path, StandardCharsets.UTF_8));
String contentSource = config.get("content.source", null);
if (contentSource != null) {
Class.forName(contentSource);
}
config.set("work.dir", createTempDir(LuceneTestCase.getTestClass().getSimpleName()).toAbsolutePath().toString());
config.set("content.source", MockContentSource.class.getName());
String dir = config.get("content.source", null);
if (dir != null) {
Class.forName(dir);
}
config.set("directory", RAMDirectory.class.getName());
if (config.get("line.file.out", null) != null) {
config.set("line.file.out", createTempFile("linefile", ".txt").toAbsolutePath().toString());
}
if (config.get("query.maker", null) != null) {
Class.forName(config.get("query.maker", null));
config.set("query.maker", MockQueryMaker.class.getName());
}
PerfRunData data = new PerfRunData(config);
try (Algorithm algo = new Algorithm(data)) {
}
foundFiles = true;
}
}
if (!foundFiles) {
fail("could not find any .alg files!");
}
}
use of org.apache.lucene.benchmark.byTask.utils.Config in project lucene-solr by apache.
the class CommitIndexTaskTest method createPerfRunData.
private PerfRunData createPerfRunData() throws Exception {
Properties props = new Properties();
props.setProperty("writer.version", Version.LATEST.toString());
// don't print anything
props.setProperty("print.props", "false");
props.setProperty("directory", "RAMDirectory");
Config config = new Config(props);
return new PerfRunData(config);
}
use of org.apache.lucene.benchmark.byTask.utils.Config in project lucene-solr by apache.
the class WriteEnwikiLineDocTaskTest method createPerfRunData.
private PerfRunData createPerfRunData(Path file, String docMakerName) throws Exception {
Properties props = new Properties();
props.setProperty("doc.maker", docMakerName);
props.setProperty("line.file.out", file.toAbsolutePath().toString());
// no accidental FS dir.
props.setProperty("directory", "RAMDirectory");
Config config = new Config(props);
return new PerfRunData(config);
}
use of org.apache.lucene.benchmark.byTask.utils.Config in project lucene-solr by apache.
the class CreateIndexTaskTest method createPerfRunData.
private PerfRunData createPerfRunData(String infoStreamValue) throws Exception {
Properties props = new Properties();
props.setProperty("writer.version", Version.LATEST.toString());
// don't print anything
props.setProperty("print.props", "false");
props.setProperty("directory", "RAMDirectory");
if (infoStreamValue != null) {
props.setProperty("writer.info.stream", infoStreamValue);
}
Config config = new Config(props);
return new PerfRunData(config);
}
Aggregations