Fork me on GitHub
  • API

    Show / Hide Table of Contents

    Class SegmentInfo

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

    Note

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

    Inheritance
    object
    SegmentInfo
    Inherited Members
    object.Equals(object, object)
    object.GetType()
    object.ReferenceEquals(object, object)
    Namespace: Lucene.Net.Index
    Assembly: Lucene.Net.dll
    Syntax
    public sealed class SegmentInfo

    Constructors

    SegmentInfo(Directory, string, string, int, bool, Codec, IDictionary<string, string>)

    Construct a new complete SegmentInfo instance from input.

    Note: this is public only to allow access from the codecs package.

    Declaration
    public SegmentInfo(Directory dir, string version, string name, int docCount, bool isCompoundFile, Codec codec, IDictionary<string, string> diagnostics)
    Parameters
    Type Name Description
    Directory dir
    string version
    string name
    int docCount
    bool isCompoundFile
    Codec codec
    IDictionary<string, string> diagnostics

    SegmentInfo(Directory, string, string, int, bool, Codec, IDictionary<string, string>, IDictionary<string, string>)

    Construct a new complete SegmentInfo instance from input.

    Note: this is public only to allow access from the codecs package.

    Declaration
    public SegmentInfo(Directory dir, string version, string name, int docCount, bool isCompoundFile, Codec codec, IDictionary<string, string> diagnostics, IDictionary<string, string> attributes)
    Parameters
    Type Name Description
    Directory dir
    string version
    string name
    int docCount
    bool isCompoundFile
    Codec codec
    IDictionary<string, string> diagnostics
    IDictionary<string, string> attributes

    Fields

    NO

    Used by some member fields to mean not present (e.g., norms, deletions).

    Declaration
    public static readonly int NO
    Field Value
    Type Description
    int

    YES

    Used by some member fields to mean present (e.g., norms, deletions).

    Declaration
    public static readonly int YES
    Field Value
    Type Description
    int

    Properties

    Attributes

    Returns the internal codec attributes map. May be null if no mappings exist.

    Declaration
    [Obsolete("no longer supported")]
    public IDictionary<string, string> Attributes { get; }
    Property Value
    Type Description
    IDictionary<string, string>

    Codec

    Gets or Sets Codec that wrote this segment. Setter can only be called once.

    Declaration
    public Codec Codec { get; set; }
    Property Value
    Type Description
    Codec

    Diagnostics

    Gets or Sets diagnostics saved into the segment when it was written.

    Declaration
    public IDictionary<string, string> Diagnostics { get; set; }
    Property Value
    Type Description
    IDictionary<string, string>

    Dir

    Where this segment resides.

    Declaration
    public Directory Dir { get; }
    Property Value
    Type Description
    Directory

    DocCount

    Returns number of documents in this segment (deletions are not taken into account).

    Declaration
    public int DocCount { get; }
    Property Value
    Type Description
    int

    Name

    Unique segment name in the directory.

    Declaration
    public string Name { get; }
    Property Value
    Type Description
    string

    UseCompoundFile

    Gets or Sets whether this segment is stored as a compound file. true if this is a compound file; else, false

    Declaration
    public bool UseCompoundFile { get; set; }
    Property Value
    Type Description
    bool

    Version

    Used by DefaultSegmentInfosReader to upgrade a 3.0 segment to record its version is "3.0". this method can be removed when we're not required to support 3x indexes anymore, e.g. in 5.0.

    NOTE: this method is used for internal purposes only - you should not modify the version of a SegmentInfo, or it may result in unexpected exceptions thrown when you attempt to open the index.

    Note

    This API is for internal purposes only and might change in incompatible ways in the next release.

    Declaration
    public string Version { get; set; }
    Property Value
    Type Description
    string

    Methods

    AddFile(string)

    Add this file to the set of files written for this segment.

    Declaration
    public void AddFile(string file)
    Parameters
    Type Name Description
    string file

    AddFiles(ICollection<string>)

    Add these files to the set of files written for this segment.

    Declaration
    public void AddFiles(ICollection<string> files)
    Parameters
    Type Name Description
    ICollection<string> files

    Equals(object)

    We consider another SegmentInfo instance equal if it has the same dir and same name.

    Declaration
    public override bool Equals(object obj)
    Parameters
    Type Name Description
    object obj
    Returns
    Type Description
    bool
    Overrides
    object.Equals(object)

    GetAttribute(string)

    Get a codec attribute value, or null if it does not exist

    Declaration
    [Obsolete("no longer supported")]
    public string GetAttribute(string key)
    Parameters
    Type Name Description
    string key
    Returns
    Type Description
    string

    GetFiles()

    Return all files referenced by this SegmentInfo.

    Declaration
    public ISet<string> GetFiles()
    Returns
    Type Description
    ISet<string>

    GetHashCode()

    Serves as the default hash function.

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    int

    A hash code for the current object.

    Overrides
    object.GetHashCode()

    PutAttribute(string, string)

    Puts a codec attribute value.

    This is a key-value mapping for the field that the codec can use to store additional metadata, and will be available to the codec when reading the segment via GetAttribute(string)

    If a value already exists for the field, it will be replaced with the new value.
    Declaration
    [Obsolete("no longer supported")]
    public string PutAttribute(string key, string value)
    Parameters
    Type Name Description
    string key
    string value
    Returns
    Type Description
    string

    SetFiles(ISet<string>)

    Sets the files written for this segment.

    Declaration
    public void SetFiles(ISet<string> files)
    Parameters
    Type Name Description
    ISet<string> files

    ToString()

    Returns a string that represents the current object.

    Declaration
    public override string ToString()
    Returns
    Type Description
    string

    A string that represents the current object.

    Overrides
    object.ToString()

    ToString(Directory, int)

    Used for debugging. Format may suddenly change.

    Current format looks like _a(3.1):c45/4, which means the segment's name is _a; it was created with Lucene 3.1 (or '?' if it's unknown); it's using compound file format (would be C if not compound); it has 45 documents; it has 4 deletions (this part is left off when there are no deletions).

    Declaration
    public string ToString(Directory dir, int delCount)
    Parameters
    Type Name Description
    Directory dir
    int delCount
    Returns
    Type Description
    string
    Back to top Copyright © 2024 The Apache Software Foundation, Licensed under the Apache License, Version 2.0
    Apache Lucene.Net, Lucene.Net, Apache, the Apache feather logo, and the Apache Lucene.Net project logo are trademarks of The Apache Software Foundation.
    All other marks mentioned may be trademarks or registered trademarks of their respective owners.