Lucene.Net
3.0.3
Lucene.Net is a .NET port of the Java Lucene Indexing Library
|
A collection of segmentInfo objects with methods for operating on those segments in relation to the file system. More...
Inherits List< SegmentInfo >, and ICloneable.
Classes | |
class | FindSegmentsFile |
Utility class for executing code that needs to do something with the current segments file. This is necessary with lock-less commits because from the time you locate the current segments file name, until you actually open it, read its contents, or check modified time, etc., it could have been deleted due to a writer commit finishing. More... | |
Public Member Functions | |
SegmentInfo | Info (int i) |
System.String | GetCurrentSegmentFileName () |
Get the segments_N filename in use by this segment infos. | |
System.String | GetNextSegmentFileName () |
Get the next segments_N filename that will be written. | |
void | Read (Directory directory, System.String segmentFileName) |
Read a particular segmentFileName. Note that this may throw an IOException if a commit is in process. | |
void | Read (Directory directory) |
This version of read uses the retry logic (for lock-less commits) to find the right segments file to load. | |
System.Object | Clone () |
Returns a copy of this instance, also copying each SegmentInfo. | |
SegmentInfos | Range (int first, int last) |
Returns a new SegmentInfos containg the SegmentInfo instances in the specified range first (inclusive) to last (exclusive), so total number of segments returned is last-first. | |
System.Collections.Generic.ICollection < string > | Files (Directory dir, bool includeSegmentsFile) |
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. | |
void | Commit (Directory dir) |
Writes & syncs to the Directory dir, taking care to remove the segments file on exception | |
System.String | SegString (Directory directory) |
bool | HasExternalSegments (Directory dir) |
override bool | Equals (object obj) |
Simple brute force implementation. If size is equal, compare items one by one. | |
override int | GetHashCode () |
Calculate hash code of SegmentInfos | |
Static Public Member Functions | |
static long | GetCurrentSegmentGeneration (System.String[] files) |
Get the generation (N) of the current segments_N file from a list of files. | |
static long | GetCurrentSegmentGeneration (Directory directory) |
Get the generation (N) of the current segments_N file in the directory. | |
static System.String | GetCurrentSegmentFileName (System.String[] files) |
Get the filename of the current segments_N file from a list of files. | |
static System.String | GetCurrentSegmentFileName (Directory directory) |
Get the filename of the current segments_N file in the directory. | |
static long | GenerationFromSegmentsFileName (System.String fileName) |
Parse the generation off the segments file name and return it. | |
static long | ReadCurrentVersion (Directory directory) |
Current version number from segments file. | |
static System.Collections.Generic.IDictionary < string, string > | ReadCurrentUserData (Directory directory) |
Returns userData from latest segments file | |
static void | SetInfoStream (System.IO.StreamWriter infoStream) |
If non-null, information about retries when loading the segments file will be printed to this. | |
Public Attributes | |
const int | FORMAT = - 1 |
The file format version, a negative number. | |
const int | FORMAT_LOCKLESS = - 2 |
This format adds details used for lockless commits. It differs slightly from the previous format in that file names are never re-used (write once). Instead, each file is written to the next generation. For example, segments_1, segments_2, etc. This allows us to not use a commit lock. See file formats for details. | |
const int | FORMAT_SINGLE_NORM_FILE = - 3 |
This format adds a "hasSingleNormFile" flag into each segment info. See LUCENE-756 for details. | |
const int | FORMAT_SHARED_DOC_STORE = - 4 |
This format allows multiple segments to share a single vectors and stored fields file. | |
const int | FORMAT_CHECKSUM = - 5 |
This format adds a checksum at the end of the file to ensure all bytes were successfully written. | |
const int | FORMAT_DEL_COUNT = - 6 |
This format adds the deletion count for each segment. This way IndexWriter can efficiently report numDocs(). | |
const int | FORMAT_HAS_PROX = - 7 |
This format adds the boolean hasProx to record if any fields in the segment store prox information (ie, have omitTermFreqAndPositions==false) | |
const int | FORMAT_USER_DATA = - 8 |
This format adds optional commit userData (String) storage. | |
const int | FORMAT_DIAGNOSTICS = - 9 |
This format adds optional per-segment String dianostics storage, and switches userData to Map | |
int | counter = 0 |
Properties | |
long | Version [get] |
version number when this SegmentInfos was generated. | |
long | Generation [get] |
long | LastGeneration [get] |
static int | DefaultGenFileRetryCount [get, set] |
Advanced: Gets or sets how many times to try loading the segments.gen file contents to determine current segment generation. This file is only referenced when the primary method (listing the directory) fails. | |
static int | DefaultGenFileRetryPauseMsec [get, set] |
static int | DefaultGenLookaheadCount [get, set] |
Advanced: set how many times to try incrementing the gen when loading the segments file. This only runs if the primary (listing directory) and secondary (opening segments.gen file) methods fail to find the segments file. | |
static StreamWriter | InfoStream [get] |
IDictionary< string, string > | UserData [get, set] |
A collection of segmentInfo objects with methods for operating on those segments in relation to the file system.
NOTE: This API is new and still experimental (subject to change suddenly in the next release)
Definition at line 39 of file SegmentInfos.cs.
System.Object Lucene.Net.Index.SegmentInfos.Clone | ( | ) |
Returns a copy of this instance, also copying each SegmentInfo.
Definition at line 440 of file SegmentInfos.cs.
void Lucene.Net.Index.SegmentInfos.Commit | ( | Directory | dir | ) |
Writes & syncs to the Directory dir, taking care to remove the segments file on exception
Definition at line 977 of file SegmentInfos.cs.
override bool Lucene.Net.Index.SegmentInfos.Equals | ( | object | obj | ) |
Simple brute force implementation. If size is equal, compare items one by one.
obj | SegmentInfos object to check equality for |
Definition at line 1040 of file SegmentInfos.cs.
System.Collections.Generic.ICollection<string> Lucene.Net.Index.SegmentInfos.Files | ( | Directory | dir, |
bool | includeSegmentsFile | ||
) |
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.
Definition at line 882 of file SegmentInfos.cs.
|
static |
Parse the generation off the segments file name and return it.
Definition at line 221 of file SegmentInfos.cs.
|
static |
Get the filename of the current segments_N file from a list of files.
files | – array of file names to check |
Definition at line 196 of file SegmentInfos.cs.
|
static |
Get the filename of the current segments_N file in the directory.
directory | – directory to search for the latest segments_N file |
Definition at line 207 of file SegmentInfos.cs.
System.String Lucene.Net.Index.SegmentInfos.GetCurrentSegmentFileName | ( | ) |
Get the segments_N filename in use by this segment infos.
Definition at line 213 of file SegmentInfos.cs.
|
static |
Get the generation (N) of the current segments_N file from a list of files.
files | – array of file names to check |
Definition at line 149 of file SegmentInfos.cs.
|
static |
Get the generation (N) of the current segments_N file in the directory.
directory | – directory to search for the latest segments_N file |
Definition at line 177 of file SegmentInfos.cs.
override int Lucene.Net.Index.SegmentInfos.GetHashCode | ( | ) |
Calculate hash code of SegmentInfos
Definition at line 1061 of file SegmentInfos.cs.
System.String Lucene.Net.Index.SegmentInfos.GetNextSegmentFileName | ( | ) |
Get the next segments_N filename that will be written.
Definition at line 240 of file SegmentInfos.cs.
bool Lucene.Net.Index.SegmentInfos.HasExternalSegments | ( | Directory | dir | ) |
Definition at line 1024 of file SegmentInfos.cs.
SegmentInfo Lucene.Net.Index.SegmentInfos.Info | ( | int | i | ) |
Definition at line 138 of file SegmentInfos.cs.
SegmentInfos Lucene.Net.Index.SegmentInfos.Range | ( | int | first, |
int | last | ||
) |
Returns a new SegmentInfos containg the SegmentInfo instances in the specified range first (inclusive) to last (exclusive), so total number of segments returned is last-first.
Definition at line 818 of file SegmentInfos.cs.
void Lucene.Net.Index.SegmentInfos.Read | ( | Directory | directory, |
System.String | segmentFileName | ||
) |
Read a particular segmentFileName. Note that this may throw an IOException if a commit is in process.
directory | – directory containing the segments file |
segmentFileName | – segment file to load |
<throws> CorruptIndexException if the index is corrupt </throws> <throws> IOException if there is a low-level IO error </throws>
Definition at line 265 of file SegmentInfos.cs.
void Lucene.Net.Index.SegmentInfos.Read | ( | Directory | directory | ) |
This version of read uses the retry logic (for lock-less commits) to find the right segments file to load.
<throws> CorruptIndexException if the index is corrupt </throws> <throws> IOException if there is a low-level IO error </throws>
Definition at line 361 of file SegmentInfos.cs.
|
static |
Returns userData from latest segments file
<throws> CorruptIndexException if the index is corrupt </throws> <throws> IOException if there is a low-level IO error </throws>
Definition at line 492 of file SegmentInfos.cs.
|
static |
Current version number from segments file.
<throws> CorruptIndexException if the index is corrupt </throws> <throws> IOException if there is a low-level IO error </throws>
Definition at line 475 of file SegmentInfos.cs.
System.String Lucene.Net.Index.SegmentInfos.SegString | ( | Directory | directory | ) |
Definition at line 983 of file SegmentInfos.cs.
|
static |
If non-null, information about retries when loading the segments file will be printed to this.
Definition at line 502 of file SegmentInfos.cs.
int Lucene.Net.Index.SegmentInfos.counter = 0 |
Definition at line 120 of file SegmentInfos.cs.
const int Lucene.Net.Index.SegmentInfos.FORMAT = - 1 |
The file format version, a negative number.
Definition at line 69 of file SegmentInfos.cs.
const int Lucene.Net.Index.SegmentInfos.FORMAT_CHECKSUM = - 5 |
This format adds a checksum at the end of the file to ensure all bytes were successfully written.
Definition at line 96 of file SegmentInfos.cs.
const int Lucene.Net.Index.SegmentInfos.FORMAT_DEL_COUNT = - 6 |
This format adds the deletion count for each segment. This way IndexWriter can efficiently report numDocs().
Definition at line 101 of file SegmentInfos.cs.
const int Lucene.Net.Index.SegmentInfos.FORMAT_DIAGNOSTICS = - 9 |
This format adds optional per-segment String dianostics storage, and switches userData to Map
Definition at line 115 of file SegmentInfos.cs.
const int Lucene.Net.Index.SegmentInfos.FORMAT_HAS_PROX = - 7 |
This format adds the boolean hasProx to record if any fields in the segment store prox information (ie, have omitTermFreqAndPositions==false)
Definition at line 107 of file SegmentInfos.cs.
const int Lucene.Net.Index.SegmentInfos.FORMAT_LOCKLESS = - 2 |
This format adds details used for lockless commits. It differs slightly from the previous format in that file names are never re-used (write once). Instead, each file is written to the next generation. For example, segments_1, segments_2, etc. This allows us to not use a commit lock. See file formats for details.
Definition at line 80 of file SegmentInfos.cs.
const int Lucene.Net.Index.SegmentInfos.FORMAT_SHARED_DOC_STORE = - 4 |
This format allows multiple segments to share a single vectors and stored fields file.
Definition at line 91 of file SegmentInfos.cs.
const int Lucene.Net.Index.SegmentInfos.FORMAT_SINGLE_NORM_FILE = - 3 |
This format adds a "hasSingleNormFile" flag into each segment info. See LUCENE-756 for details.
Definition at line 86 of file SegmentInfos.cs.
const int Lucene.Net.Index.SegmentInfos.FORMAT_USER_DATA = - 8 |
This format adds optional commit userData (String) storage.
Definition at line 110 of file SegmentInfos.cs.
|
staticgetset |
Advanced: Gets or sets how many times to try loading the segments.gen file contents to determine current segment generation. This file is only referenced when the primary method (listing the directory) fails.
Definition at line 519 of file SegmentInfos.cs.
|
staticgetset |
Definition at line 525 of file SegmentInfos.cs.
|
staticgetset |
Advanced: set how many times to try incrementing the gen when loading the segments file. This only runs if the primary (listing directory) and secondary (opening segments.gen file) methods fail to find the segments file.
Definition at line 537 of file SegmentInfos.cs.
|
get |
Definition at line 463 of file SegmentInfos.cs.
|
staticget |
Definition at line 545 of file SegmentInfos.cs.
|
get |
Definition at line 468 of file SegmentInfos.cs.
|
getset |
Definition at line 1005 of file SegmentInfos.cs.
|
get |
version number when this SegmentInfos was generated.
Definition at line 458 of file SegmentInfos.cs.