本文整理汇总了Java中org.apache.lucene.benchmark.byTask.utils.Config.set方法的典型用法代码示例。如果您正苦于以下问题:Java Config.set方法的具体用法?Java Config.set怎么用?Java Config.set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.lucene.benchmark.byTask.utils.Config
的用法示例。
在下文中一共展示了Config.set方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: prepareQueries
import org.apache.lucene.benchmark.byTask.utils.Config; //导入方法依赖的package包/类
@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 {
i--;//skip
}
}
} catch (NoMoreDataException e) {
//all-done
} finally {
src.close();
}
return queries.toArray(new Query[queries.size()]);
}
示例2: testParseExamples
import org.apache.lucene.benchmark.byTask.utils.Config; //导入方法依赖的package包/类
/** Test the parsing of example scripts **/
public void testParseExamples() throws Exception {
// hackedy-hack-hack
boolean foundFiles = false;
final File examplesDir = new File(ConfLoader.class.getResource(".").toURI());
for (File algFile : examplesDir.listFiles(new FileFilter() {
@Override
public boolean accept(File pathname) { return pathname.isFile() && pathname.getName().endsWith(".alg"); }
})) {
try {
Config config = new Config(new InputStreamReader(new FileInputStream(algFile), StandardCharsets.UTF_8));
String contentSource = config.get("content.source", null);
if (contentSource != null) { Class.forName(contentSource); }
config.set("work.dir", createTempDir(LuceneTestCase.getTestClass().getSimpleName()).getAbsolutePath());
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").getAbsolutePath());
}
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);
new Algorithm(data);
} catch (Throwable t) {
throw new AssertionError("Could not parse sample file: " + algFile, t);
}
foundFiles = true;
}
if (!foundFiles) {
fail("could not find any .alg files!");
}
}
示例3: testParseExamples
import org.apache.lucene.benchmark.byTask.utils.Config; //导入方法依赖的package包/类
/** Test the parsing of example scripts **/
public void testParseExamples() throws Exception {
// hackedy-hack-hack
boolean foundFiles = false;
final File examplesDir = new File(ConfLoader.class.getResource(".").toURI());
for (File algFile : examplesDir.listFiles(new FileFilter() {
@Override
public boolean accept(File pathname) { return pathname.isFile() && pathname.getName().endsWith(".alg"); }
})) {
try {
Config config = new Config(new InputStreamReader(new FileInputStream(algFile), "UTF-8"));
String contentSource = config.get("content.source", null);
if (contentSource != null) { Class.forName(contentSource); }
config.set("work.dir", new File(TEMP_DIR,"work").getAbsolutePath());
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", new File(TEMP_DIR,"o.txt").getAbsolutePath());
}
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);
new Algorithm(data);
} catch (Throwable t) {
t.printStackTrace();
fail("Could not parse sample file: " + algFile + " reason:"
+ t.getClass() + ":" + t.getMessage());
}
foundFiles = true;
}
if (!foundFiles) {
fail("could not find any .alg files!");
}
}
示例4: prepareQueries
import org.apache.lucene.benchmark.byTask.utils.Config; //导入方法依赖的package包/类
@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<Query>();
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 {
i--;//skip
}
}
} catch (NoMoreDataException e) {
//all-done
} finally {
src.close();
}
return queries.toArray(new Query[queries.size()]);
}