org.apache.lucene.codecs.lucene62

## Class Lucene62SegmentInfoFormat

- java.lang.Object
- - org.apache.lucene.codecs.SegmentInfoFormat
  - - org.apache.lucene.codecs.lucene62.Lucene62SegmentInfoFormat

-     public class Lucene62SegmentInfoFormat
      extends SegmentInfoFormat

  Lucene 6.2 Segment info format.

  Files:

  - `.si`: Header, SegVersion, SegSize, IsCompoundFile, Diagnostics, Files, Attributes, IndexSort, Footer
  Data types:
  - Header --> `IndexHeader`
  - SegSize --> `Int32`
  - SegVersion --> `String`
  - Files --> `Set<String>`
  - Diagnostics,Attributes --> `Map<String,String>`
  - IsCompoundFile --> `Int8`
  - IndexSort --> `Int32` count, followed by `count` SortField
  - SortField --> `String` field name, followed by `Int32` sort type ID, followed by `Int8` indicatating reversed sort, followed by a type-specific encoding of the optional missing value
  - Footer --> `CodecFooter`
  Field Descriptions:
  - SegVersion is the code version that created the segment.
  - SegSize is the number of documents contained in the segment index.
  - IsCompoundFile records whether the segment is written as a compound file or not. If this is -1, the segment is not a compound file. If it is 1, the segment is a compound file.
  - The Diagnostics Map is privately written by `IndexWriter`, as a debugging aid, for each segment it creates. It includes metadata like the current Lucene version, OS, Java version, why the segment was created (merge, flush, addIndexes), etc.
  - Files is a list of files referred to by this segment.
  See Also:
    `SegmentInfos`
  WARNING: This API is experimental and might change in incompatible ways in the next release.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `SI_EXTENSION` File extension used to store `SegmentInfo`.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Lucene62SegmentInfoFormat()` Sole constructor.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `SegmentInfo` | `read(Directory dir, String segment, byte[] segmentID, IOContext context)` Read `SegmentInfo` data from a directory.
    `void` | `write(Directory dir, SegmentInfo info, IOContext ioContext)` Write `SegmentInfo` data.

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

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

- - ### Field Detail

    - #### SI_EXTENSION

          public static final String SI_EXTENSION

      File extension used to store `SegmentInfo`.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### Lucene62SegmentInfoFormat

          public Lucene62SegmentInfoFormat()

      Sole constructor.

  - ### Method Detail

    - #### read

          public SegmentInfo read(Directory dir,
                                  String segment,
                                  byte[] segmentID,
                                  IOContext context)
                           throws IOException

      Description copied from class: `SegmentInfoFormat`
      Read `SegmentInfo` data from a directory.
      Specified by:
        `read` in class `SegmentInfoFormat`
      Parameters:
        `dir` - directory to read from
        `segment` - name of the segment to read
        `segmentID` - expected identifier for the segment
      Returns:
        infos instance to be populated with data
      Throws:
        `IOException` - If an I/O error occurs

    - #### write

          public void write(Directory dir,
                            SegmentInfo info,
                            IOContext ioContext)
                     throws IOException

      Description copied from class: `SegmentInfoFormat`
      Write `SegmentInfo` data. The codec must add its SegmentInfo filename(s) to `info` before doing i/o.
      Specified by:
        `write` in class `SegmentInfoFormat`
      Throws:
        `IOException` - If an I/O error occurs

Copyright © 2000-2019 Apache Software Foundation. All Rights Reserved.