Class 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!
Inheritance
Namespace:
Assembly: Lucene.Net.NetCore.dll
Syntax
public class CheckIndex : object
Constructors
Name | Description |
---|---|
CheckIndex(Directory) | Create a new CheckIndex on the directory. |
Methods
Name | Description |
---|---|
CheckIndex_Renamed_Method() | Returns a CheckIndex.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<String>) | Returns a CheckIndex.Status instance detailing the state of the index. |
FixIndex(CheckIndex.Status) | 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. |
Main(String[]) | Command-line interface to check and fix an index. Run it like this:
WARNING: Run without -fix, this tool will open the index, report version information and report any exceptions it hits and what action it would take if -fix were specified. With -fix, this tool will remove any segments that have issues and write a new segments_N file. This means all documents contained in the affected segments will be removed. This tool exits with exit code 1 if the index cannot be opened or has any corruption, else 0. |
SetInfoStream(StreamWriter) | Set infoStream where messages should go. If null, no messages are printed |