org.apache.lucene.index

## Class SegmentWriteState

- java.lang.Object
- - org.apache.lucene.index.SegmentWriteState

    public class SegmentWriteState
    extends Object

Holder class for common parameters used during write.

WARNING: This API is experimental and might change in incompatible ways in the next release.

### Field Summary

Fields
`IOContext` `context` `IOContext` for all writes; you should pass this to `Directory.createOutput(String,IOContext)`.
`int` `delCountOnFlush` Number of deleted documents set while flushing the segment.
`Directory` `directory` `Directory` where this segment will be written to.
`FieldInfos` `fieldInfos` `FieldInfos` describing all fields in this segment.
`InfoStream` `infoStream` `InfoStream` used for debugging messages.
`MutableBits` `liveDocs` `MutableBits` recording live documents; this is only set if there is one or more deleted documents.
`org.apache.lucene.index.BufferedDeletes` `segDeletes` Deletes to apply while we are flushing the segment.
`SegmentInfo` `segmentInfo` `SegmentInfo` describing this segment.
`String` `segmentSuffix` Unique suffix for any postings files written for this segment.
`int` `termIndexInterval` Expert: The fraction of terms in the "dictionary" which should be stored in RAM.

### Constructor Summary

Constructors
Constructor and Description
`SegmentWriteState(InfoStream infoStream, Directory directory, SegmentInfo segmentInfo, FieldInfos fieldInfos, int termIndexInterval, org.apache.lucene.index.BufferedDeletes segDeletes, IOContext context)` Sole constructor.
`SegmentWriteState(SegmentWriteState state, String segmentSuffix)` Create a shallow `SegmentWriteState` copy final a format ID

### Method Summary

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### infoStream

    public final InfoStream infoStream

`InfoStream` used for debugging messages.

#### directory

    public final Directory directory

`Directory` where this segment will be written to.

#### segmentInfo

    public final SegmentInfo segmentInfo

`SegmentInfo` describing this segment.

#### fieldInfos

    public final FieldInfos fieldInfos

`FieldInfos` describing all fields in this segment.

#### delCountOnFlush

    public int delCountOnFlush

Number of deleted documents set while flushing the segment.

#### segDeletes

    public final org.apache.lucene.index.BufferedDeletes segDeletes

Deletes to apply while we are flushing the segment. A Term is enrolled in here if it was deleted at one point, and it's mapped to the docIDUpto, meaning any docID < docIDUpto containing this term should be deleted.

#### liveDocs

    public MutableBits liveDocs

`MutableBits` recording live documents; this is only set if there is one or more deleted documents.

#### segmentSuffix

    public final String segmentSuffix

Unique suffix for any postings files written for this segment. `PerFieldPostingsFormat` sets this for each of the postings formats it wraps. If you create a new `PostingsFormat` then any files you write/read must be derived using this suffix (use `IndexFileNames.segmentFileName(String,String,String)`).

#### termIndexInterval

    public int termIndexInterval

Expert: The fraction of terms in the "dictionary" which should be stored in RAM. Smaller values use more memory, but make searching slightly faster, while larger values use less memory and make searching slightly slower. Searching is typically not dominated by dictionary lookup, so tweaking this is rarely useful.

#### context

    public final IOContext context

`IOContext` for all writes; you should pass this to `Directory.createOutput(String,IOContext)`.

### Constructor Detail

#### SegmentWriteState

    public SegmentWriteState(InfoStream infoStream,
                     Directory directory,
                     SegmentInfo segmentInfo,
                     FieldInfos fieldInfos,
                     int termIndexInterval,
                     org.apache.lucene.index.BufferedDeletes segDeletes,
                     IOContext context)

Sole constructor.

#### SegmentWriteState

    public SegmentWriteState(SegmentWriteState state,
                     String segmentSuffix)

Create a shallow `SegmentWriteState` copy final a format ID