C# Class Lucene.Net.Index.CheckIndex

Basic tool and API to check the health of an index and write a new segments file that removes reference to problematic segments.

As this tool checks every byte in the index, on a large index it can take quite a long time to run.

WARNING: this tool and API is new and experimental and is subject to suddenly change in the next release. Please make a complete backup of your index before using this to fix your index!

Show file Open project: synhershko/lucene.net Class Usage Examples

Public Methods

Method Description
CheckIndex ( Lucene.Net.Store.Directory dir ) : System

Create a new CheckIndex on the directory.

CheckIndex_Renamed_Method ( ) : Status

Returns a Status instance detailing the state of the index.

As this method checks every byte in the index, on a large index it can take quite a long time to run.

WARNING: make sure you only call this when the index is not opened by any writer.

CheckIndex_Renamed_Method ( List onlySegments ) : Status

Returns a Status instance detailing the state of the index.

FixIndex ( Status result ) : void

Repairs the index using previously returned result from CheckIndex. Note that this does not remove any of the unreferenced files after it's done; you must separately open an IndexWriter, which deletes unreferenced files when it's created.

WARNING: this writes a new segments file into the index, effectively removing all documents in broken segments from the index. BE CAREFUL.

WARNING: Make sure you only call this when the index is not opened by any writer.

SetInfoStream ( StreamWriter @out ) : void

Set infoStream where messages should go. If null, no messages are printed

Private Methods

Method Description
AssertsOn ( ) : bool
Main ( System args ) : void
Msg ( System msg ) : void
TestAsserts ( ) : bool
TestFieldNorms ( IEnumerable fieldNames, Lucene.Net.Index.SegmentReader reader ) : Status.FieldNormStatus

Test field norms.

TestStoredFields ( SegmentInfo info, Lucene.Net.Index.SegmentReader reader, System format ) : Status.StoredFieldStatus

Test stored fields for a segment.

TestTermIndex ( SegmentInfo info, Lucene.Net.Index.SegmentReader reader ) : Status.TermIndexStatus

Test the term index.

TestTermVectors ( SegmentInfo info, Lucene.Net.Index.SegmentReader reader, System format ) : Status.TermVectorStatus

Test term vectors for a segment.

Method Details

CheckIndex() public method

Create a new CheckIndex on the directory.
public CheckIndex ( Lucene.Net.Store.Directory dir ) : System
dir Lucene.Net.Store.Directory
return System

CheckIndex_Renamed_Method() public method

Returns a Status instance detailing the state of the index.

As this method checks every byte in the index, on a large index it can take quite a long time to run.

WARNING: make sure you only call this when the index is not opened by any writer.

public CheckIndex_Renamed_Method ( ) : Status
return Status

CheckIndex_Renamed_Method() public method

Returns a Status instance detailing the state of the index.
public CheckIndex_Renamed_Method ( List onlySegments ) : Status
onlySegments List list of specific segment names to check /// ///

As this method checks every byte in the specified /// segments, on a large index it can take quite a long /// time to run. /// ///

WARNING: make sure /// you only call this when the index is not opened by any /// writer. ///

return Status

FixIndex() public method

Repairs the index using previously returned result from CheckIndex. Note that this does not remove any of the unreferenced files after it's done; you must separately open an IndexWriter, which deletes unreferenced files when it's created.

WARNING: this writes a new segments file into the index, effectively removing all documents in broken segments from the index. BE CAREFUL.

WARNING: Make sure you only call this when the index is not opened by any writer.

public FixIndex ( Status result ) : void
result Status
return void

SetInfoStream() public method

Set infoStream where messages should go. If null, no messages are printed
public SetInfoStream ( StreamWriter @out ) : void
@out StreamWriter
return void