FileDocCategorySizeDatePackage
CreateIndexTask.javaAPI DocApache Lucene 2.2.02044Sat Jun 16 22:20:58 BST 2007org.apache.lucene.benchmark.byTask.tasks

CreateIndexTask

public class CreateIndexTask extends PerfTask
Create an index.
Other side effects: index writer object in perfRunData is set.
Relevant properties: merge.factor , max.buffered.

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

    super(runData);
  
Methods Summary
public intdoLogic()

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

    iw.setUseCompoundFile(cmpnd);
    iw.setMergeFactor(mrgf);
    iw.setMaxBufferedDocs(mxbf);

    getRunData().setIndexWriter(iw);
    return 1;