• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java PerfRunData类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.lucene.benchmark.byTask.PerfRunData的典型用法代码示例。如果您正苦于以下问题:Java PerfRunData类的具体用法?Java PerfRunData怎么用?Java PerfRunData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PerfRunData类属于org.apache.lucene.benchmark.byTask包,在下文中一共展示了PerfRunData类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: configureWriter

import org.apache.lucene.benchmark.byTask.PerfRunData; //导入依赖的package包/类
public static IndexWriter configureWriter(Config config, PerfRunData runData, OpenMode mode, IndexCommit commit) throws IOException {
  IndexWriterConfig iwc = createWriterConfig(config, runData, mode, commit);
  String infoStreamVal = config.get("writer.info.stream", null);
  if (infoStreamVal != null) {
    if (infoStreamVal.equals("SystemOut")) {
      iwc.setInfoStream(System.out);
    } else if (infoStreamVal.equals("SystemErr")) {
      iwc.setInfoStream(System.err);
    } else {
      File f = new File(infoStreamVal).getAbsoluteFile();
      iwc.setInfoStream(new PrintStream(new BufferedOutputStream(new FileOutputStream(f)), false, Charset.defaultCharset().name()));
    }
  }
  IndexWriter writer = new IndexWriter(runData.getDirectory(), iwc);
  return writer;
}
 
开发者ID:europeana,项目名称:search,代码行数:17,代码来源:CreateIndexTask.java


示例2: PerfTask

import org.apache.lucene.benchmark.byTask.PerfRunData; //导入依赖的package包/类
public PerfTask(PerfRunData runData) {
  this();
  this.runData = runData;
  Config config = runData.getConfig();
  this.maxDepthLogStart = config.get("task.max.depth.log",0);

  String logStepAtt = "log.step";
  String taskLogStepAtt = "log.step." + name;
  if (config.get(taskLogStepAtt, null) != null) {
    logStepAtt = taskLogStepAtt;
  }

  // It's important to read this from Config, to support vals-by-round.
  logStep = config.get(logStepAtt, DEFAULT_LOG_STEP);
  // To avoid the check 'if (logStep > 0)' in tearDown(). This effectively
  // turns logging off.
  if (logStep <= 0) {
    logStep = Integer.MAX_VALUE;
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:21,代码来源:PerfTask.java


示例3: testJustDate

import org.apache.lucene.benchmark.byTask.PerfRunData; //导入依赖的package包/类
/** Fail by default when there's only date */
public void testJustDate() throws Exception {
  File file = new File(getWorkDir(), "one-line");
  PerfRunData runData = createPerfRunData(file, false, JustDateDocMaker.class.getName());
  WriteLineDocTask wldt = new WriteLineDocTask(runData);
  wldt.doLogic();
  wldt.close();
  
  BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(file), StandardCharsets.UTF_8));
  try {
    String line = br.readLine();
    assertHeaderLine(line);
    line = br.readLine();
    assertNull(line);
  } finally {
    br.close();
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:19,代码来源:WriteLineDocTaskTest.java


示例4: testLegalJustDate

import org.apache.lucene.benchmark.byTask.PerfRunData; //导入依赖的package包/类
public void testLegalJustDate() throws Exception {
  File file = new File(getWorkDir(), "one-line");
  PerfRunData runData = createPerfRunData(file, false, LegalJustDateDocMaker.class.getName());
  WriteLineDocTask wldt = new WriteLineDocTask(runData);
  wldt.doLogic();
  wldt.close();
  
  BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(file), StandardCharsets.UTF_8));
  try {
    String line = br.readLine();
    assertHeaderLine(line);
    line = br.readLine();
    assertNotNull(line);
  } finally {
    br.close();
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:18,代码来源:WriteLineDocTaskTest.java


示例5: testEmptyDoc

import org.apache.lucene.benchmark.byTask.PerfRunData; //导入依赖的package包/类
public void testEmptyDoc() throws Exception {
  File file = new File(getWorkDir(), "one-line");
  PerfRunData runData = createPerfRunData(file, true, EmptyDocMaker.class.getName());
  WriteLineDocTask wldt = new WriteLineDocTask(runData);
  wldt.doLogic();
  wldt.close();
  
  BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(file), StandardCharsets.UTF_8));
  try {
    String line = br.readLine();
    assertHeaderLine(line);
    line = br.readLine();
    assertNotNull(line);
  } finally {
    br.close();
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:18,代码来源:WriteLineDocTaskTest.java


示例6: testAddIndexesDefault

import org.apache.lucene.benchmark.byTask.PerfRunData; //导入依赖的package包/类
public void testAddIndexesDefault() throws Exception {
  PerfRunData runData = createPerfRunData();
  // create the target index first
  new CreateIndexTask(runData).doLogic();
  
  AddIndexesTask task = new AddIndexesTask(runData);
  task.setup();
  
  // add the input index
  task.doLogic();
  
  // close the index
  new CloseIndexTask(runData).doLogic();
  
  assertIndex(runData);
  
  runData.close();
}
 
开发者ID:europeana,项目名称:search,代码行数:19,代码来源:AddIndexesTaskTest.java


示例7: testAddIndexesDir

import org.apache.lucene.benchmark.byTask.PerfRunData; //导入依赖的package包/类
public void testAddIndexesDir() throws Exception {
  PerfRunData runData = createPerfRunData();
  // create the target index first
  new CreateIndexTask(runData).doLogic();
  
  AddIndexesTask task = new AddIndexesTask(runData);
  task.setup();
  
  // add the input index
  task.setParams("true");
  task.doLogic();
  
  // close the index
  new CloseIndexTask(runData).doLogic();
  
  assertIndex(runData);
  
  runData.close();
}
 
开发者ID:europeana,项目名称:search,代码行数:20,代码来源:AddIndexesTaskTest.java


示例8: testAddIndexesReader

import org.apache.lucene.benchmark.byTask.PerfRunData; //导入依赖的package包/类
public void testAddIndexesReader() throws Exception {
  PerfRunData runData = createPerfRunData();
  // create the target index first
  new CreateIndexTask(runData).doLogic();
  
  AddIndexesTask task = new AddIndexesTask(runData);
  task.setup();
  
  // add the input index
  task.setParams("false");
  task.doLogic();
  
  // close the index
  new CloseIndexTask(runData).doLogic();
  
  assertIndex(runData);
  
  runData.close();
}
 
开发者ID:europeana,项目名称:search,代码行数:20,代码来源:AddIndexesTaskTest.java


示例9: doLogic

import org.apache.lucene.benchmark.byTask.PerfRunData; //导入依赖的package包/类
@Override
public int doLogic() throws IOException {
  PerfRunData runData = getRunData();
  DirectoryTaxonomyReader taxoReader = new DirectoryTaxonomyReader(runData.getTaxonomyDir());
  runData.setTaxonomyReader(taxoReader);
  // We transfer reference to the run data
  taxoReader.decRef();
  return 1;
}
 
开发者ID:europeana,项目名称:search,代码行数:10,代码来源:OpenTaxonomyReaderTask.java


示例10: WriteLineDocTask

import org.apache.lucene.benchmark.byTask.PerfRunData; //导入依赖的package包/类
public WriteLineDocTask(PerfRunData runData) throws Exception {
  super(runData);
  Config config = runData.getConfig();
  fname = config.get("line.file.out", null);
  if (fname == null) {
    throw new IllegalArgumentException("line.file.out must be set");
  }
  OutputStream out = StreamUtils.outputStream(new File(fname));
  lineFileOut = new PrintWriter(new BufferedWriter(new OutputStreamWriter(out, StandardCharsets.UTF_8), StreamUtils.BUFFER_SIZE));
  docMaker = runData.getDocMaker();
  
  // init fields 
  String f2r = config.get("line.fields",null);
  if (f2r == null) {
    fieldsToWrite = DEFAULT_FIELDS;
  } else {
    if (f2r.indexOf(SEP)>=0) {
      throw new IllegalArgumentException("line.fields "+f2r+" should not contain the separator char: "+SEP);
    }
    fieldsToWrite = f2r.split(","); 
  }
  
  // init sufficient fields
  sufficientFields = new boolean[fieldsToWrite.length];
  String suff = config.get("sufficient.fields",DEFAULT_SUFFICIENT_FIELDS);
  if (",".equals(suff)) {
    checkSufficientFields = false;
  } else {
    checkSufficientFields = true;
    HashSet<String> sf = new HashSet<>(Arrays.asList(suff.split(",")));
    for (int i=0; i<fieldsToWrite.length; i++) {
      if (sf.contains(fieldsToWrite[i])) {
        sufficientFields[i] = true;
      }
    }
  }
  
  writeHeader(lineFileOut);
}
 
开发者ID:europeana,项目名称:search,代码行数:40,代码来源:WriteLineDocTask.java


示例11: doLogic

import org.apache.lucene.benchmark.byTask.PerfRunData; //导入依赖的package包/类
@Override
public int doLogic() throws IOException {
  PerfRunData runData = getRunData();
  Config config = runData.getConfig();
  runData.setIndexWriter(configureWriter(config, runData, OpenMode.CREATE, null));
  return 1;
}
 
开发者ID:europeana,项目名称:search,代码行数:8,代码来源:CreateIndexTask.java


示例12: doLogic

import org.apache.lucene.benchmark.byTask.PerfRunData; //导入依赖的package包/类
@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;
}
 
开发者ID:europeana,项目名称:search,代码行数:16,代码来源:OpenIndexTask.java


示例13: ReadTask

import org.apache.lucene.benchmark.byTask.PerfRunData; //导入依赖的package包/类
public ReadTask(PerfRunData runData) {
  super(runData);
  if (withSearch()) {
    queryMaker = getQueryMaker();
  } else {
    queryMaker = null;
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:9,代码来源:ReadTask.java


示例14: setup

import org.apache.lucene.benchmark.byTask.PerfRunData; //导入依赖的package包/类
@Override
public void setup() throws Exception {
  super.setup();
  //check to make sure either the doc is being stored
  PerfRunData data = getRunData();
  if (data.getConfig().get("doc.stored", false) == false){
    throw new Exception("doc.stored must be set to true");
  }
  maxDocCharsToAnalyze = data.getConfig().get("highlighter.maxDocCharsToAnalyze", Highlighter.DEFAULT_MAX_CHARS_TO_ANALYZE);
}
 
开发者ID:europeana,项目名称:search,代码行数:11,代码来源:SearchTravRetHighlightTask.java


示例15: setup

import org.apache.lucene.benchmark.byTask.PerfRunData; //导入依赖的package包/类
@Override
public void setup() throws Exception {
  super.setup();
  //check to make sure either the doc is being stored
  PerfRunData data = getRunData();
  if (data.getConfig().get("doc.stored", false) == false){
    throw new Exception("doc.stored must be set to true");
  }
  if (data.getConfig().get("doc.term.vector.offsets", false) == false){
    throw new Exception("doc.term.vector.offsets must be set to true");
  }
  if (data.getConfig().get("doc.term.vector.positions", false) == false){
    throw new Exception("doc.term.vector.positions must be set to true");
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:16,代码来源:SearchTravRetVectorHighlightTask.java


示例16: setup

import org.apache.lucene.benchmark.byTask.PerfRunData; //导入依赖的package包/类
@Override
public void setup() throws Exception {
  super.setup();
  //check to make sure either the doc is being stored
  PerfRunData runData = getRunData();
  Config config = runData.getConfig();
  clnName = config.get("collector.class", "");
}
 
开发者ID:europeana,项目名称:search,代码行数:9,代码来源:SearchWithCollectorTask.java


示例17: TaskSequence

import org.apache.lucene.benchmark.byTask.PerfRunData; //导入依赖的package包/类
public TaskSequence (PerfRunData runData, String name, TaskSequence parent, boolean parallel) {
  super(runData);
  collapsable = (name == null);
  name = (name!=null ? name : (parallel ? "Par" : "Seq"));
  setName(name);
  setSequenceName();
  this.parent = parent;
  this.parallel = parallel;
  tasks = new ArrayList<>();
  logByTimeMsec = runData.getConfig().get("report.time.step.msec", 0);
}
 
开发者ID:europeana,项目名称:search,代码行数:12,代码来源:TaskSequence.java


示例18: main

import org.apache.lucene.benchmark.byTask.PerfRunData; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
  Properties p = initProps();
  Config conf = new Config(p);
  PerfRunData runData = new PerfRunData(conf);
  
  // 1. top sequence
  TaskSequence top = new TaskSequence(runData,null,null,false); // top level, not parallel
  
  // 2. task to create the index
  CreateIndexTask create = new CreateIndexTask(runData);
  top.addTask(create);
  
  // 3. task seq to add 500 docs (order matters - top to bottom - add seq to top, only then add to seq)
  TaskSequence seq1 = new TaskSequence(runData,"AddDocs",top,false);
  seq1.setRepetitions(500);
  seq1.setNoChildReport();
  top.addTask(seq1);

  // 4. task to add the doc
  AddDocTask addDoc = new AddDocTask(runData);
  //addDoc.setParams("1200"); // doc size limit if supported
  seq1.addTask(addDoc); // order matters 9see comment above)

  // 5. task to close the index
  CloseIndexTask close = new CloseIndexTask(runData);
  top.addTask(close);

  // task to report
  RepSumByNameTask rep = new RepSumByNameTask(runData);
  top.addTask(rep);

  // print algorithm
  System.out.println(top.toString());
  
  // execute
  top.doLogic();
}
 
开发者ID:europeana,项目名称:search,代码行数:38,代码来源:Sample.java


示例19: createPerfRunData

import org.apache.lucene.benchmark.byTask.PerfRunData; //导入依赖的package包/类
private PerfRunData createPerfRunData() throws Exception {
  Properties props = new Properties();
  props.setProperty("writer.version", TEST_VERSION_CURRENT.toString());
  props.setProperty("print.props", "false"); // don't print anything
  props.setProperty("directory", "RAMDirectory");
  Config config = new Config(props);
  return new PerfRunData(config);
}
 
开发者ID:europeana,项目名称:search,代码行数:9,代码来源:CommitIndexTaskTest.java


示例20: testCommitData

import org.apache.lucene.benchmark.byTask.PerfRunData; //导入依赖的package包/类
public void testCommitData() throws Exception {
  PerfRunData runData = createPerfRunData();
  new CreateIndexTask(runData).doLogic();
  CommitIndexTask task = new CommitIndexTask(runData);
  task.setParams("params");
  task.doLogic();
  SegmentInfos infos = new SegmentInfos();
  infos.read(runData.getDirectory());
  assertEquals("params", infos.getUserData().get(OpenReaderTask.USER_DATA));
  new CloseIndexTask(runData).doLogic();
}
 
开发者ID:europeana,项目名称:search,代码行数:12,代码来源:CommitIndexTaskTest.java



注:本文中的org.apache.lucene.benchmark.byTask.PerfRunData类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java StackMapFrame类代码示例发布时间:2022-05-22
下一篇:
Java NoValueValidator类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap