org.apache.lucene.index

## Class SegmentInfo

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

-     public final class SegmentInfo
      extends java.lang.Object

  Information about a segment such as it's name, directory, and files related to the segment. *

  NOTE: This API is new and still experimental (subject to change suddenly in the next release)

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `Directory` | `dir`
    `int` | `docCount`
    `java.lang.String` | `name`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SegmentInfo(java.lang.String name, int docCount, Directory dir)`
    `SegmentInfo(java.lang.String name, int docCount, Directory dir, boolean isCompoundFile, boolean hasSingleNormFile)`
    `SegmentInfo(java.lang.String name, int docCount, Directory dir, boolean isCompoundFile, boolean hasSingleNormFile, int docStoreOffset, java.lang.String docStoreSegment, boolean docStoreIsCompoundFile, boolean hasProx)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.Object` | `clone()`
    `boolean` | `equals(java.lang.Object obj)` We consider another SegmentInfo instance equal if it has the same dir and same name.
    `java.util.List` | `files()`
    `int` | `getDelCount()`
    `java.lang.String` | `getDelFileName()`
    `java.util.Map` | `getDiagnostics()`
    `boolean` | `getDocStoreIsCompoundFile()`
    `int` | `getDocStoreOffset()`
    `java.lang.String` | `getDocStoreSegment()`
    `boolean` | `getHasProx()`
    `java.lang.String` | `getNormFileName(int number)` Get the file name for the norms file for this field.
    `boolean` | `getUseCompoundFile()` Returns true if this segment is stored as a compound file; else, false.
    `boolean` | `hasDeletions()`
    `int` | `hashCode()`
    `boolean` | `hasSeparateNorms()` Returns true if any fields in this segment have separate norms.
    `boolean` | `hasSeparateNorms(int fieldNumber)` Returns true if this field for this segment has saved a separate norms file (_<segment>_N.sX).
    `java.lang.String` | `segString(Directory dir)` Used for debugging
    `long` | `sizeInBytes()` Returns total size in bytes of all of files used by this segment.
    `java.lang.String` | `toString()`

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

      `finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### name

          public java.lang.String name

    - #### docCount

          public int docCount

    - #### dir

          public Directory dir

  - ### Constructor Detail

    - #### SegmentInfo

          public SegmentInfo(java.lang.String name,
                             int docCount,
                             Directory dir)

    - #### SegmentInfo

          public SegmentInfo(java.lang.String name,
                             int docCount,
                             Directory dir,
                             boolean isCompoundFile,
                             boolean hasSingleNormFile)

    - #### SegmentInfo

          public SegmentInfo(java.lang.String name,
                             int docCount,
                             Directory dir,
                             boolean isCompoundFile,
                             boolean hasSingleNormFile,
                             int docStoreOffset,
                             java.lang.String docStoreSegment,
                             boolean docStoreIsCompoundFile,
                             boolean hasProx)

  - ### Method Detail

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

    - #### getDiagnostics

          public java.util.Map getDiagnostics()

    - #### sizeInBytes

          public long sizeInBytes()
                           throws java.io.IOException

      Returns total size in bytes of all of files used by this segment.
      Throws:
        `java.io.IOException`

    - #### hasDeletions

          public boolean hasDeletions()
                               throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### clone

          public java.lang.Object clone()

      Overrides:
        `clone` in class `java.lang.Object`

    - #### getDelFileName

          public java.lang.String getDelFileName()

    - #### hasSeparateNorms

          public boolean hasSeparateNorms(int fieldNumber)
                                   throws java.io.IOException

      Returns true if this field for this segment has saved a separate norms file (_<segment>_N.sX).
      Parameters:
        `fieldNumber` - the field index to check
      Throws:
        `java.io.IOException`

    - #### hasSeparateNorms

          public boolean hasSeparateNorms()
                                   throws java.io.IOException

      Returns true if any fields in this segment have separate norms.
      Throws:
        `java.io.IOException`

    - #### getNormFileName

          public java.lang.String getNormFileName(int number)
                                           throws java.io.IOException

      Get the file name for the norms file for this field.
      Parameters:
        `number` - field index
      Throws:
        `java.io.IOException`

    - #### getUseCompoundFile

          public boolean getUseCompoundFile()
                                     throws java.io.IOException

      Returns true if this segment is stored as a compound file; else, false.
      Throws:
        `java.io.IOException`

    - #### getDelCount

          public int getDelCount()
                          throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### getDocStoreOffset

          public int getDocStoreOffset()

    - #### getDocStoreIsCompoundFile

          public boolean getDocStoreIsCompoundFile()

    - #### getDocStoreSegment

          public java.lang.String getDocStoreSegment()

    - #### getHasProx

          public boolean getHasProx()

    - #### files

          public java.util.List files()
                               throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### segString

          public java.lang.String segString(Directory dir)

      Used for debugging

    - #### equals

          public boolean equals(java.lang.Object obj)

      We consider another SegmentInfo instance equal if it has the same dir and same name.
      Overrides:
        `equals` in class `java.lang.Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `java.lang.Object`

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