## org.apache.lucene.benchmark.byTask.tasks
Class CreateIndexTask

    java.lang.Object
      org.apache.lucene.benchmark.byTask.tasks.PerfTask
          org.apache.lucene.benchmark.byTask.tasks.CreateIndexTask

All Implemented Interfaces:
  Cloneable

    public class CreateIndexTask

extends PerfTask

Create an index.
Other side effects: index writer object in perfRunData is set.
Relevant properties: `merge.factor (default 10), max.buffered (default no flush), max.field.length (default 10,000 tokens), max.field.length, compound (default true), ram.flush.mb [default 0], merge.policy (default org.apache.lucene.index.LogByteSizeMergePolicy), merge.scheduler (default org.apache.lucene.index.ConcurrentMergeScheduler), concurrent.merge.scheduler.max.thread.count and concurrent.merge.scheduler.max.merge.count (defaults per ConcurrentMergeScheduler)` .

This task also supports a "writer.info.stream" property with the following values:

- SystemOut - sets `IndexWriter.setInfoStream(java.io.PrintStream)` to `System.out`.
- SystemErr - sets `IndexWriter.setInfoStream(java.io.PrintStream)` to `System.err`.
- <file_name> - attempts to create a file given that name and sets `IndexWriter.setInfoStream(java.io.PrintStream)` to that file. If this denotes an invalid file name, or some error occurs, an exception will be thrown.

Field Summary

Fields inherited from class org.apache.lucene.benchmark.byTask.tasks.PerfTask
`logStep, NEW_LINE, params, stopNow`

Constructor Summary
`CreateIndexTask(PerfRunData runData)`

Method Summary
`static org.apache.lucene.index.IndexWriter` `configureWriter(Config config, PerfRunData runData, org.apache.lucene.index.IndexWriterConfig.OpenMode mode, org.apache.lucene.index.IndexCommit commit)`
`static org.apache.lucene.index.IndexWriterConfig` `createWriterConfig(Config config, PerfRunData runData, org.apache.lucene.index.IndexWriterConfig.OpenMode mode, org.apache.lucene.index.IndexCommit commit)`
`int` `doLogic()` Perform the task once (ignoring repetitions specification) Return number of work items done by this task.
`static org.apache.lucene.index.IndexDeletionPolicy` `getIndexDeletionPolicy(Config config)`

Methods inherited from class org.apache.lucene.benchmark.byTask.tasks.PerfTask
`clone, close, getBackgroundDeltaPriority, getDepth, getLogMessage, getName, getParams, getRunData, getRunInBackground, isDisableCounting, runAndMaybeStats, setDepth, setDisableCounting, setName, setParams, setRunInBackground, setup, shouldNeverLogAtStart, shouldNotRecordStats, stopNow, supportsParams, tearDown, toString`

Methods inherited from class java.lang.Object
`equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### CreateIndexTask

    public CreateIndexTask(PerfRunData runData)

Method Detail

### getIndexDeletionPolicy

    public static org.apache.lucene.index.IndexDeletionPolicy getIndexDeletionPolicy(Config config)

### doLogic

    public int doLogic()
                throws IOException

  Description copied from class: `PerfTask`
  Perform the task once (ignoring repetitions specification) Return number of work items done by this task. For indexing that can be number of docs added. For warming that can be number of scanned items, etc.

  Specified by:
    `doLogic` in class `PerfTask`
  Returns:
    number of work items done by this task.
  Throws:
    `IOException`

### createWriterConfig

    public static org.apache.lucene.index.IndexWriterConfig createWriterConfig(Config config,
                                                                               PerfRunData runData,
                                                                               org.apache.lucene.index.IndexWriterConfig.OpenMode mode,
                                                                               org.apache.lucene.index.IndexCommit commit)

### configureWriter

    public static org.apache.lucene.index.IndexWriter configureWriter(Config config,
                                                                      PerfRunData runData,
                                                                      org.apache.lucene.index.IndexWriterConfig.OpenMode mode,
                                                                      org.apache.lucene.index.IndexCommit commit)
                                                               throws org.apache.lucene.index.CorruptIndexException,
                                                                      org.apache.lucene.store.LockObtainFailedException,
                                                                      IOException

  Throws:
    `org.apache.lucene.index.CorruptIndexException`
    `org.apache.lucene.store.LockObtainFailedException`
    `IOException`