FileDocCategorySizeDatePackage
OpenIndexTask.javaAPI DocApache Lucene 2.2.02218Sat Jun 16 22:20:58 BST 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.
Relevant properties: merge.factor , max.buffered.

Fields Summary
public static final int
DEFAULT_MAX_BUFFERED
public static final int
DEFAULT_MERGE_PFACTOR
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",DEFAULT_MERGE_PFACTOR);
    int mxbf = config.get("max.buffered",DEFAULT_MAX_BUFFERED);

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