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
    System.Object
    SegmentInfo
    Inherited Members
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    Namespace: Lucene.Net.Index
    Assembly: Lucene.Net.dll
    Syntax
    public sealed class SegmentInfo

    Constructors

    | Improve this Doc View Source

    SegmentInfo(Directory, String, String, Int32, Boolean, 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
    System.String version
    System.String name
    System.Int32 docCount
    System.Boolean isCompoundFile
    Codec codec
    System.Collections.Generic.IDictionary<System.String, System.String> diagnostics
    | Improve this Doc View Source

    SegmentInfo(Directory, String, String, Int32, Boolean, 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
    System.String version
    System.String name
    System.Int32 docCount
    System.Boolean isCompoundFile
    Codec codec
    System.Collections.Generic.IDictionary<System.String, System.String> diagnostics
    System.Collections.Generic.IDictionary<System.String, System.String> attributes

    Fields

    | Improve this Doc View Source

    NO

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

    Declaration
    public static readonly int NO
    Field Value
    Type Description
    System.Int32
    | Improve this Doc View Source

    YES

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

    Declaration
    public static readonly int YES
    Field Value
    Type Description
    System.Int32

    Properties

    | Improve this Doc View Source

    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
    System.Collections.Generic.IDictionary<System.String, System.String>
    | Improve this Doc View Source

    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
    | Improve this Doc View Source

    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
    System.Collections.Generic.IDictionary<System.String, System.String>
    | Improve this Doc View Source

    Dir

    Where this segment resides.

    Declaration
    public Directory Dir { get; }
    Property Value
    Type Description
    Directory
    | Improve this Doc View Source

    DocCount

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

    Declaration
    public int DocCount { get; }
    Property Value
    Type Description
    System.Int32
    | Improve this Doc View Source

    Name

    Unique segment name in the directory.

    Declaration
    public string Name { get; }
    Property Value
    Type Description
    System.String
    | Improve this Doc View Source

    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
    System.Boolean
    | Improve this Doc View Source

    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
    System.String

    Methods

    | Improve this Doc View Source

    AddFile(String)

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

    Declaration
    public void AddFile(string file)
    Parameters
    Type Name Description
    System.String file
    | Improve this Doc View Source

    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
    System.Collections.Generic.ICollection<System.String> files
    | Improve this Doc View Source

    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
    System.Object obj
    Returns
    Type Description
    System.Boolean
    Overrides
    System.Object.Equals(System.Object)
    | Improve this Doc View Source

    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
    System.String key
    Returns
    Type Description
    System.String
    | Improve this Doc View Source

    GetFiles()

    Return all files referenced by this SegmentInfo.

    Declaration
    public ISet<string> GetFiles()
    Returns
    Type Description
    System.Collections.Generic.ISet<System.String>
    | Improve this Doc View Source

    GetHashCode()

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    System.Int32
    Overrides
    System.Object.GetHashCode()
    | Improve this Doc View Source

    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
    System.String key
    System.String value
    Returns
    Type Description
    System.String
    | Improve this Doc View Source

    SetFiles(ISet<String>)

    Sets the files written for this segment.

    Declaration
    public void SetFiles(ISet<string> files)
    Parameters
    Type Name Description
    System.Collections.Generic.ISet<System.String> files
    | Improve this Doc View Source

    ToString()

    Declaration
    public override string ToString()
    Returns
    Type Description
    System.String
    Overrides
    System.Object.ToString()
    | Improve this Doc View Source

    ToString(Directory, Int32)

    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
    System.Int32 delCount
    Returns
    Type Description
    System.String
    • Improve this Doc
    • View Source
    Back to top Copyright © 2021 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.