C# Class Lucene.Net.Index.SegmentInfos

Inheritance: System.Collections.ArrayList
Show file Open project: paulirwin/lucene.net Class Usage Examples

Public Properties

Property Type Description
Counter int

Public Methods

Method Description
Add ( Lucene.Net.Index.SegmentCommitInfo si ) : void

Appends the provided SegmentCommitInfo.

AddAll ( IEnumerable sis ) : void

Appends the provided SegmentCommitInfos.

AsList ( ) : IList

Returns all contained segments as an unmodifiable List view.

Changed ( ) : void

Call this before committing if changes have been made to the segments.

Clear ( ) : void

Clear all SegmentCommitInfos.

Clone ( ) : object

Returns a copy of this instance, also copying each SegmentInfo.

Files ( Directory dir, bool includeSegmentsFile ) : ICollection

Returns all file names referenced by SegmentInfo instances matching the provided Directory (ie files associated with any "external" segments are skipped). The returned collection is recomputed on each invocation.

GenerationFromSegmentsFileName ( string fileName ) : long

Parse the generation off the segments file name and return it.

GetLastCommitGeneration ( Directory directory ) : long

Get the generation of the most recent commit to the index in this directory (N in the segments_N file).

GetLastCommitGeneration ( string files ) : long

Get the generation of the most recent commit to the list of index files (N in the segments_N file).

GetLastCommitSegmentsFileName ( Directory directory ) : string

Get the filename of the segments_N file for the most recent commit to the index in this Directory.

GetLastCommitSegmentsFileName ( string files ) : string

Get the filename of the segments_N file for the most recent commit in the list of index files.

Info ( int i ) : Lucene.Net.Index.SegmentCommitInfo

Returns SegmentCommitInfo at the provided index.

Read ( Directory directory ) : void

Find the latest commit ({@code segments_N file}) and load all SegmentCommitInfos.

Read ( Directory directory, string segmentFileName ) : void

Read a particular segmentFileName. Note that this may throw an IOException if a commit is in process.

Remove ( Lucene.Net.Index.SegmentCommitInfo si ) : void

Remove the provided SegmentCommitInfo.

WARNING: O(N) cost

SegmentInfos ( ) : System

Sole constructor. Typically you call this and then use {@link #read(Directory) or #read(Directory,String)} to populate each {@link SegmentCommitInfo}. Alternatively, you can add/remove your own SegmentCommitInfos.

Size ( ) : int

Returns number of SegmentCommitInfos.

ToString ( Directory directory ) : string

Returns readable description of this segment.

TotalDocCount ( ) : int

Returns sum of all segment's docCounts. Note that this does not include deletions

WriteSegmentsGen ( Directory dir, long generation ) : void

A utility for writing the IndexFileNames#SEGMENTS_GEN file to a Directory.

NOTE: this is an internal utility which is kept public so that it's accessible by code from other packages. You should avoid calling this method unless you're absolutely sure what you're doing! @lucene.internal

Private Methods

Method Description
ApplyMergeChanges ( MergePolicy merge, bool dropSegment ) : void

applies all changes caused by committing a merge to this SegmentInfos

Commit ( Directory dir ) : void

Writes & syncs to the Directory dir, taking care to remove the segments file on exception

Note: #changed() should be called prior to this method if changes have been made to this SegmentInfos instance

Contains ( Lucene.Net.Index.SegmentCommitInfo si ) : bool

Return true if the provided {@link SegmentCommitInfo} is contained.

WARNING: O(N) cost

CreateBackupSegmentInfos ( ) : IList
FinishCommit ( Directory dir ) : void
IndexOf ( Lucene.Net.Index.SegmentCommitInfo si ) : int

Returns index of the provided {@link SegmentCommitInfo}.

WARNING: O(N) cost

Message ( string message ) : void

Prints the given message to the infoStream. Note, this method does not check for null infoStream. It assumes this check has been performed by the caller, which is recommended to avoid the (usually) expensive message creation.

PrepareCommit ( Directory dir ) : void

Call this to start a commit. this writes the new segments file, but writes an invalid checksum at the end, so that it is not visible to readers. Once this is called you must call #finishCommit to complete the commit or #rollbackCommit to abort it.

Note: #changed() should be called prior to this method if changes have been made to this SegmentInfos instance

Remove ( int index ) : void

Remove the SegmentCommitInfo at the provided index.

WARNING: O(N) cost

Replace ( SegmentInfos other ) : void

Replaces all segments in this instance, but keeps generation, version, counter so that future commits remain write once.

RollbackCommit ( Directory dir ) : void
RollbackSegmentInfos ( IList infos ) : void
SegmentWasUpgraded ( Directory directory, SegmentInfo si ) : bool
UpdateGeneration ( SegmentInfos other ) : void
Write ( Directory directory ) : void
Write3xInfo ( Directory dir, SegmentInfo si, IOContext context ) : string

Method Details

Add() public method

Appends the provided SegmentCommitInfo.
public Add ( Lucene.Net.Index.SegmentCommitInfo si ) : void
si Lucene.Net.Index.SegmentCommitInfo
return void

AddAll() public method

Appends the provided SegmentCommitInfos.
public AddAll ( IEnumerable sis ) : void
sis IEnumerable
return void

AsList() public method

Returns all contained segments as an unmodifiable List view.
public AsList ( ) : IList
return IList

Changed() public method

Call this before committing if changes have been made to the segments.
public Changed ( ) : void
return void

Clear() public method

Clear all SegmentCommitInfos.
public Clear ( ) : void
return void

Clone() public method

Returns a copy of this instance, also copying each SegmentInfo.
public Clone ( ) : object
return object

Files() public method

Returns all file names referenced by SegmentInfo instances matching the provided Directory (ie files associated with any "external" segments are skipped). The returned collection is recomputed on each invocation.
public Files ( Directory dir, bool includeSegmentsFile ) : ICollection
dir Directory
includeSegmentsFile bool
return ICollection

GenerationFromSegmentsFileName() public static method

Parse the generation off the segments file name and return it.
public static GenerationFromSegmentsFileName ( string fileName ) : long
fileName string
return long

GetLastCommitGeneration() public static method

Get the generation of the most recent commit to the index in this directory (N in the segments_N file).
public static GetLastCommitGeneration ( Directory directory ) : long
directory Directory -- directory to search for the latest segments_N file
return long

GetLastCommitGeneration() public static method

Get the generation of the most recent commit to the list of index files (N in the segments_N file).
public static GetLastCommitGeneration ( string files ) : long
files string -- array of file names to check
return long

GetLastCommitSegmentsFileName() public static method

Get the filename of the segments_N file for the most recent commit to the index in this Directory.
public static GetLastCommitSegmentsFileName ( Directory directory ) : string
directory Directory -- directory to search for the latest segments_N file
return string

GetLastCommitSegmentsFileName() public static method

Get the filename of the segments_N file for the most recent commit in the list of index files.
public static GetLastCommitSegmentsFileName ( string files ) : string
files string -- array of file names to check
return string

Info() public method

Returns SegmentCommitInfo at the provided index.
public Info ( int i ) : Lucene.Net.Index.SegmentCommitInfo
i int
return Lucene.Net.Index.SegmentCommitInfo

Read() public method

Find the latest commit ({@code segments_N file}) and load all SegmentCommitInfos.
public Read ( Directory directory ) : void
directory Directory
return void

Read() public method

Read a particular segmentFileName. Note that this may throw an IOException if a commit is in process.
if the index is corrupt if there is a low-level IO error
public Read ( Directory directory, string segmentFileName ) : void
directory Directory -- directory containing the segments file
segmentFileName string -- segment file to load
return void

Remove() public method

Remove the provided SegmentCommitInfo.

WARNING: O(N) cost

public Remove ( Lucene.Net.Index.SegmentCommitInfo si ) : void
si Lucene.Net.Index.SegmentCommitInfo
return void

SegmentInfos() public method

Sole constructor. Typically you call this and then use {@link #read(Directory) or #read(Directory,String)} to populate each {@link SegmentCommitInfo}. Alternatively, you can add/remove your own SegmentCommitInfos.
public SegmentInfos ( ) : System
return System

Size() public method

Returns number of SegmentCommitInfos.
public Size ( ) : int
return int

ToString() public method

Returns readable description of this segment.
public ToString ( Directory directory ) : string
directory Directory
return string

TotalDocCount() public method

Returns sum of all segment's docCounts. Note that this does not include deletions
public TotalDocCount ( ) : int
return int

WriteSegmentsGen() public static method

A utility for writing the IndexFileNames#SEGMENTS_GEN file to a Directory.

NOTE: this is an internal utility which is kept public so that it's accessible by code from other packages. You should avoid calling this method unless you're absolutely sure what you're doing! @lucene.internal

public static WriteSegmentsGen ( Directory dir, long generation ) : void
dir Directory
generation long
return void

Property Details

Counter public property

Used to name new segments.
public int Counter
return int