use of org.apache.lucene.benchmark.byTask.utils.Config in project lucene-solr by apache.
the class SpatialFileQueryMaker method prepareQueries.
@Override
protected Query[] prepareQueries() throws Exception {
final int maxQueries = config.get("query.file.maxQueries", 1000);
Config srcConfig = new Config(new Properties());
srcConfig.set("docs.file", config.get("query.file", null));
srcConfig.set("line.parser", config.get("query.file.line.parser", null));
srcConfig.set("content.source.forever", "false");
List<Query> queries = new ArrayList<>();
LineDocSource src = new LineDocSource();
try {
src.setConfig(srcConfig);
src.resetInputs();
DocData docData = new DocData();
for (int i = 0; i < maxQueries; i++) {
docData = src.getNextDocData(docData);
Shape shape = SpatialDocMaker.makeShapeFromString(strategy, docData.getName(), docData.getBody());
if (shape != null) {
shape = shapeConverter.convert(shape);
queries.add(makeQueryFromShape(shape));
} else {
//skip
i--;
}
}
} catch (NoMoreDataException e) {
//all-done
} finally {
src.close();
}
return queries.toArray(new Query[queries.size()]);
}
use of org.apache.lucene.benchmark.byTask.utils.Config in project lucene-solr by apache.
the class CreateIndexTask method doLogic.
@Override
public int doLogic() throws IOException {
PerfRunData runData = getRunData();
Config config = runData.getConfig();
runData.setIndexWriter(configureWriter(config, runData, OpenMode.CREATE, null));
return 1;
}
use of org.apache.lucene.benchmark.byTask.utils.Config in project lucene-solr by apache.
the class PerfTaskTest method createPerfRunData.
private PerfRunData createPerfRunData(boolean setLogStep, int logStepVal, boolean setTaskLogStep, int taskLogStepVal) throws Exception {
Properties props = new Properties();
if (setLogStep) {
props.setProperty("log.step", Integer.toString(logStepVal));
}
if (setTaskLogStep) {
props.setProperty("log.step.MyPerf", Integer.toString(taskLogStepVal));
}
// 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 SearchWithSortTaskTest method testSetParams_docField.
public void testSetParams_docField() throws Exception {
SearchWithSortTask task = new SearchWithSortTask(new PerfRunData(new Config(new Properties())));
task.setParams("doc");
assertEquals(SortField.Type.DOC, task.getSort().getSort()[0].getType());
}
use of org.apache.lucene.benchmark.byTask.utils.Config in project lucene-solr by apache.
the class WriteLineDocTaskTest method createPerfRunData.
private PerfRunData createPerfRunData(Path file, boolean allowEmptyDocs, 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");
if (allowEmptyDocs) {
props.setProperty("sufficient.fields", ",");
}
if (docMakerName.equals(LegalJustDateDocMaker.class.getName())) {
props.setProperty("line.fields", DocMaker.DATE_FIELD);
props.setProperty("sufficient.fields", DocMaker.DATE_FIELD);
}
Config config = new Config(props);
return new PerfRunData(config);
}
Aggregations