Lucene.Net  3.0.3
Lucene.Net is a .NET port of the Java Lucene Indexing Library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties
Classes | Public Member Functions | Static Public Member Functions | List of all members
Lucene.Net.Index.CheckIndex Class Reference

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

Classes

class  Status
 Returned from CheckIndex_Renamed_Method() detailing the health and status of the index. More...
 

Public Member Functions

 CheckIndex (Directory dir)
 Create a new CheckIndex on the directory.
 
virtual void SetInfoStream (StreamWriter @out)
 Set infoStream where messages should go. If null, no messages are printed
 
virtual Status CheckIndex_Renamed_Method ()
 Returns a Status instance detailing the state of the index.
 
virtual Status CheckIndex_Renamed_Method (List< string > onlySegments)
 Returns a Status instance detailing the state of the index.
 
virtual void FixIndex (Status result)
 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.
 

Static Public Member Functions

static void Main (System.String[] args)
 Command-line interface to check and fix an index. Run it like this:
 

Detailed Description

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!

Definition at line 43 of file CheckIndex.cs.

Constructor & Destructor Documentation

Lucene.Net.Index.CheckIndex.CheckIndex ( Directory  dir)

Create a new CheckIndex on the directory.

Definition at line 255 of file CheckIndex.cs.

Member Function Documentation

virtual Status Lucene.Net.Index.CheckIndex.CheckIndex_Renamed_Method ( )
virtual

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.

Definition at line 306 of file CheckIndex.cs.

virtual Status Lucene.Net.Index.CheckIndex.CheckIndex_Renamed_Method ( List< string >  onlySegments)
virtual

Returns a Status instance detailing the state of the index.

Parameters
onlySegmentslist 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.

Definition at line 325 of file CheckIndex.cs.

virtual void Lucene.Net.Index.CheckIndex.FixIndex ( Status  result)
virtual

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.

Definition at line 859 of file CheckIndex.cs.

static void Lucene.Net.Index.CheckIndex.Main ( System.String[]  args)
static

Command-line interface to check and fix an index. Run it like this:

java -ea:Lucene.Net... Lucene.Net.Index.CheckIndex pathToIndex [-fix] [-segment X] [-segment Y]

  • -fix: actually write a new segments_N file, removing any problematic segments
  • -segment X: only check the specified segment(s). This can be specified multiple times, to check more than one segment, eg -segment _2 -segment _a. You can't use this with the -fix option.

WARNING: -fix should only be used on an emergency basis as it will cause documents (perhaps many) to be permanently removed from the index. Always make a backup copy of your index before running this! Do not run this tool on an index that is actively being written to. You have been warned!

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.

Definition at line 908 of file CheckIndex.cs.

virtual void Lucene.Net.Index.CheckIndex.SetInfoStream ( StreamWriter @  out)
virtual

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

Definition at line 264 of file CheckIndex.cs.


The documentation for this class was generated from the following file: