The CheckIndex type exposes the following members.

Constructors

  NameDescription
Public methodCheckIndex
Create a new CheckIndex on the directory.

Methods

  NameDescription
Public methodStatic memberCheck(Directory, Boolean) Obsolete.
Returns true if index is clean, else false.
Public methodStatic memberCheck(Directory, Boolean, IList) Obsolete.
Returns true if index is clean, else false.
Public methodCheckIndex_Renamed_Method()()()()
Returns a {@link 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 methodCheckIndex_Renamed_Method(IList)
Returns a {@link Status} instance detailing the state of the index.
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Protected methodFinalize
Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
(Inherited from Object.)
Public methodFixIndex
Repairs the index using previously returned result from {@link #checkIndex}. Note that this does not remove any of the unreferenced files after it's done; you must separately open an {@link 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 methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodStatic memberMain
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]
            
  • CopyC#
    -fix
    : actually write a new segments_N file, removing any problematic segments
  • CopyC#
    -segment X
    : only check the specified segment(s). This can be specified multiple times, to check more than one segment, eg
    CopyC#
    -segment _2
                -segment _a
    . You can't use this with the -fix option.

WARNING:

CopyC#
-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.

Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodSetInfoStream
Set infoStream where messages should go. If null, no messages are printed
Public methodToString
Returns a String that represents the current Object.
(Inherited from Object.)

Fields

  NameDescription
Public fieldStatic memberout_Renamed Obsolete.
Default PrintStream for all CheckIndex instances.

See Also