Class SegmentInfo
Information about a segment such as it's name, directory, and files related to the segment.
Inheritance
Inherited Members
Namespace: Lucene.Net.Index
Assembly: Lucene.Net.dll
Syntax
public sealed class SegmentInfo
Constructors
| Improve this Doc View SourceSegmentInfo(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 |
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 SourceNO
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 |
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 SourceAttributes
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> |
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 |
---|---|
System.Collections.Generic.IDictionary<System.String, System.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 |
---|---|
System.Int32 |
Name
Unique segment name in the directory.
Declaration
public string Name { get; }
Property Value
Type | Description |
---|---|
System.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 |
---|---|
System.Boolean |
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.
Declaration
public string Version { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Methods
| Improve this Doc View SourceAddFile(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 |
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 |
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
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 |
GetFiles()
Return all files referenced by this SegmentInfo.
Declaration
public ISet<string> GetFiles()
Returns
Type | Description |
---|---|
System.Collections.Generic.ISet<System.String> |
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 |
Overrides
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 |
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 |
ToString()
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String |
Overrides
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 |