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

Java DocMaker类代码示例

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

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



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

示例1: createPerfRunData

import org.apache.lucene.benchmark.byTask.feeds.DocMaker; //导入依赖的package包/类
private PerfRunData createPerfRunData(File file, 
                                      boolean allowEmptyDocs,
                                      String docMakerName) throws Exception {
  Properties props = new Properties();
  props.setProperty("doc.maker", docMakerName);
  props.setProperty("line.file.out", file.getAbsolutePath());
  props.setProperty("directory", "RAMDirectory"); // no accidental FS dir.
  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);
}
 
开发者ID:europeana,项目名称:search,代码行数:18,代码来源:WriteLineDocTaskTest.java


示例2: ExtractWikipedia

import org.apache.lucene.benchmark.byTask.feeds.DocMaker; //导入依赖的package包/类
public ExtractWikipedia(DocMaker docMaker, File outputDir) {
  this.outputDir = outputDir;
  this.docMaker = docMaker;
  System.out.println("Deleting all files in " + outputDir);
  File[] files = outputDir.listFiles();
  for (int i = 0; i < files.length; i++) {
    files[i].delete();
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:10,代码来源:ExtractWikipedia.java


示例3: extract

import org.apache.lucene.benchmark.byTask.feeds.DocMaker; //导入依赖的package包/类
public void extract() throws Exception {
  Document doc = null;
  System.out.println("Starting Extraction");
  long start = System.currentTimeMillis();
  try {
    while ((doc = docMaker.makeDocument()) != null) {
      create(doc.get(DocMaker.ID_FIELD), doc.get(DocMaker.TITLE_FIELD), doc
          .get(DocMaker.DATE_FIELD), doc.get(DocMaker.BODY_FIELD));
    }
  } catch (NoMoreDataException e) {
    //continue
  }
  long finish = System.currentTimeMillis();
  System.out.println("Extraction took " + (finish - start) + " ms");
}
 
开发者ID:europeana,项目名称:search,代码行数:16,代码来源:ExtractWikipedia.java


示例4: main

import org.apache.lucene.benchmark.byTask.feeds.DocMaker; //导入依赖的package包/类
public static void main(String[] args) throws Exception {

    File wikipedia = null;
    File outputDir = new File("./enwiki");
    boolean keepImageOnlyDocs = true;
    for (int i = 0; i < args.length; i++) {
      String arg = args[i];
      if (arg.equals("--input") || arg.equals("-i")) {
        wikipedia = new File(args[i + 1]);
        i++;
      } else if (arg.equals("--output") || arg.equals("-o")) {
        outputDir = new File(args[i + 1]);
        i++;
      } else if (arg.equals("--discardImageOnlyDocs") || arg.equals("-d")) {
        keepImageOnlyDocs = false;
      }
    }
    
    Properties properties = new Properties();
    properties.setProperty("docs.file", wikipedia.getAbsolutePath());
    properties.setProperty("content.source.forever", "false");
    properties.setProperty("keep.image.only.docs", String.valueOf(keepImageOnlyDocs));
    Config config = new Config(properties);

    ContentSource source = new EnwikiContentSource();
    source.setConfig(config);
    
    DocMaker docMaker = new DocMaker();
    docMaker.setConfig(config, source);
    docMaker.resetInputs();
    if (wikipedia.exists()) {
      System.out.println("Extracting Wikipedia to: " + outputDir + " using EnwikiContentSource");
      outputDir.mkdirs();
      ExtractWikipedia extractor = new ExtractWikipedia(docMaker, outputDir);
      extractor.extract();
    } else {
      printUsage();
    }
  }
 
开发者ID:europeana,项目名称:search,代码行数:40,代码来源:ExtractWikipedia.java


示例5: lineFileOut

import org.apache.lucene.benchmark.byTask.feeds.DocMaker; //导入依赖的package包/类
@Override
protected PrintWriter lineFileOut(Document doc) {
  IndexableField titleField = doc.getField(DocMaker.TITLE_FIELD);
  if (titleField!=null && titleField.stringValue().startsWith("Category:")) {
    return categoryLineFileOut;
  }
  return super.lineFileOut(doc);
}
 
开发者ID:europeana,项目名称:search,代码行数:9,代码来源:WriteEnwikiLineDocTask.java


示例6: setup

import org.apache.lucene.benchmark.byTask.feeds.DocMaker; //导入依赖的package包/类
@Override
public void setup() throws Exception {
  super.setup();
  DocMaker docMaker = getRunData().getDocMaker();
  if (docSize > 0) {
    doc = docMaker.makeDocument(docSize);
  } else {
    doc = docMaker.makeDocument();
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:11,代码来源:AddDocTask.java


示例7: doLogic

import org.apache.lucene.benchmark.byTask.feeds.DocMaker; //导入依赖的package包/类
@Override
public int doLogic() throws Exception {
  final String docID = doc.get(DocMaker.ID_FIELD);
  if (docID == null) {
    throw new IllegalStateException("document must define the docid field");
  }
  final IndexWriter iw = getRunData().getIndexWriter();
  iw.updateDocument(new Term(DocMaker.ID_FIELD, docID), doc);
  return 1;
}
 
开发者ID:europeana,项目名称:search,代码行数:11,代码来源:UpdateDocTask.java


示例8: PerfRunData

import org.apache.lucene.benchmark.byTask.feeds.DocMaker; //导入依赖的package包/类
public PerfRunData (Config config) throws Exception {
  this.config = config;
  // analyzer (default is standard analyzer)
  analyzer = NewAnalyzerTask.createAnalyzer(config.get("analyzer",
      "org.apache.lucene.analysis.standard.StandardAnalyzer"));

  // content source
  String sourceClass = config.get("content.source", "org.apache.lucene.benchmark.byTask.feeds.SingleDocSource");
  contentSource = Class.forName(sourceClass).asSubclass(ContentSource.class).newInstance();
  contentSource.setConfig(config);

  // doc maker
  docMaker = Class.forName(config.get("doc.maker",
      "org.apache.lucene.benchmark.byTask.feeds.DocMaker")).asSubclass(DocMaker.class).newInstance();
  docMaker.setConfig(config, contentSource);
  // facet source
  facetSource = Class.forName(config.get("facet.source",
      "org.apache.lucene.benchmark.byTask.feeds.RandomFacetSource")).asSubclass(FacetSource.class).newInstance();
  facetSource.setConfig(config);
  // query makers
  readTaskQueryMaker = new HashMap<>();
  qmkrClass = Class.forName(config.get("query.maker","org.apache.lucene.benchmark.byTask.feeds.SimpleQueryMaker")).asSubclass(QueryMaker.class);

  // index stuff
  reinit(false);
  
  // statistic points
  points = new Points(config);
  
  if (Boolean.valueOf(config.get("log.queries","false")).booleanValue()) {
    System.out.println("------------> queries:");
    System.out.println(getQueryMaker(new SearchTask(this)).printQueries());
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:35,代码来源:PerfRunData.java


示例9: PerfRunData

import org.apache.lucene.benchmark.byTask.feeds.DocMaker; //导入依赖的package包/类
public PerfRunData (Config config) throws Exception {
  this.config = config;
  // analyzer (default is standard analyzer)
  analyzer = NewAnalyzerTask.createAnalyzer(config.get("analyzer",
      "org.apache.lucene.analysis.standard.StandardAnalyzer"));

  // content source
  String sourceClass = config.get("content.source", "org.apache.lucene.benchmark.byTask.feeds.SingleDocSource");
  contentSource = Class.forName(sourceClass).asSubclass(ContentSource.class).newInstance();
  contentSource.setConfig(config);

  // doc maker
  docMaker = Class.forName(config.get("doc.maker",
      "org.apache.lucene.benchmark.byTask.feeds.DocMaker")).asSubclass(DocMaker.class).newInstance();
  docMaker.setConfig(config, contentSource);
  // facet source
  facetSource = Class.forName(config.get("facet.source",
      "org.apache.lucene.benchmark.byTask.feeds.RandomFacetSource")).asSubclass(FacetSource.class).newInstance();
  facetSource.setConfig(config);
  // query makers
  readTaskQueryMaker = new HashMap<Class<? extends ReadTask>,QueryMaker>();
  qmkrClass = Class.forName(config.get("query.maker","org.apache.lucene.benchmark.byTask.feeds.SimpleQueryMaker")).asSubclass(QueryMaker.class);

  // index stuff
  reinit(false);
  
  // statistic points
  points = new Points(config);
  
  if (Boolean.valueOf(config.get("log.queries","false")).booleanValue()) {
    System.out.println("------------> queries:");
    System.out.println(getQueryMaker(new SearchTask(this)).printQueries());
  }
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:35,代码来源:PerfRunData.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java CacheDirectiveStatsProto类代码示例发布时间:2022-05-22
下一篇:
Java Exception类代码示例发布时间: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