Package org.apache.lucene.benchmark.byTask.utils

Examples of org.apache.lucene.benchmark.byTask.utils.Config


*/
public class Sample {

  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
   
View Full Code Here


    if (setIndexProps) {
      props.setProperty("doc.index.props", Boolean.toString(indexPropsVal));
    }
   
    // Create PerfRunData
    Config config = new Config(props);
    PerfRunData runData = new PerfRunData(config);

    TaskSequence tasks = new TaskSequence(runData, getTestName(), null, false);
    tasks.addTask(new CreateIndexTask(runData));
    tasks.addTask(new AddDocTask(runData));
View Full Code Here

    if (setBodyNormsProp) {
      props.setProperty("doc.body.tokenized.norms", Boolean.toString(bodyNormsVal));
    }
   
    // Create PerfRunData
    Config config = new Config(props);
   
    DocMaker dm = new DocMaker();
    dm.setConfig(config, new OneDocSource());
    return dm.makeDocument();
  }
View Full Code Here

    ps.close();
   
    Properties props = new Properties();
    props.setProperty("docs.file", f.getAbsolutePath());
    props.setProperty("content.source.forever", "false");
    Config config = new Config(props);
   
    ContentSource source = new LineDocSource();
    source.setConfig(config);
   
    DocMaker dm = new DocMaker();
View Full Code Here

    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);
View Full Code Here

  }

  @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);
View Full Code Here

    final File examplesDir = new File(ConfLoader.class.getResource(".").toURI());
    for (File algFile : examplesDir.listFiles(new FileFilter() {
      public boolean accept(File pathname) { return pathname.isFile() && pathname.getName().endsWith(".alg"); }
    })) {
      try {
        Config config = new Config(new FileReader(algFile));
        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();
View Full Code Here

    if (setIndexProps) {
      props.setProperty("doc.index.props", Boolean.toString(indexPropsVal));
    }
   
    // Create PerfRunData
    Config config = new Config(props);
    PerfRunData runData = new PerfRunData(config);

    TaskSequence tasks = new TaskSequence(runData, getName(), null, false);
    tasks.addTask(new CreateIndexTask(runData));
    tasks.addTask(new AddDocTask(runData));
View Full Code Here

    if (setBodyNormsProp) {
      props.setProperty("doc.body.tokenized.norms", Boolean.toString(bodyNormsVal));
    }
   
    // Create PerfRunData
    Config config = new Config(props);
   
    DocMaker dm = new DocMaker();
    dm.setConfig(config);
    return dm.makeDocument();
  }
View Full Code Here

   
    Properties props = new Properties();
    props.setProperty("content.source", "org.apache.lucene.benchmark.byTask.feeds.LineDocSource");
    props.setProperty("docs.file", f.getAbsolutePath());
    props.setProperty("content.source.forever", "false");
    Config config = new Config(props);
    DocMaker dm = new DocMaker();
    dm.setConfig(config);
    dm.resetInputs();
    dm.resetInputs();
    dm.close();
View Full Code Here

TOP

Related Classes of org.apache.lucene.benchmark.byTask.utils.Config

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.