FileDocCategorySizeDatePackage
OpenIndexTask.javaAPI DocApache Lucene 2.1.02058Wed Feb 14 10:46:14 GMT 2007org.apache.lucene.benchmark.byTask.tasks

OpenIndexTask

public class OpenIndexTask extends PerfTask
Open an index writer. Other side effects: index writer object in perfRunData is set.

Fields Summary
Constructors Summary
public OpenIndexTask(org.apache.lucene.benchmark.byTask.PerfRunData runData)

    super(runData);
  
Methods Summary
public intdoLogic()

    Directory dir = getRunData().getDirectory();
    Analyzer analyzer = getRunData().getAnalyzer();
    IndexWriter writer = new IndexWriter(dir, analyzer, false);
    
    Config config = getRunData().getConfig();
    
    boolean cmpnd = config.get("compound",true);
    int mrgf = config.get("merge.factor",10);
    int mxbf = config.get("max.buffered",10);

    // must update params for newly opened writer
    writer.setMaxBufferedDocs(mxbf);
    writer.setMergeFactor(mrgf);
    writer.setUseCompoundFile(cmpnd); // this one redundant?
    
    getRunData().setIndexWriter(writer);
    return 1;