Class CheckIndex

java.lang.Object
org.apache.lucene.index.CheckIndex
All Implemented Interfaces:
Closeable, AutoCloseable

public final class CheckIndex extends Object implements Closeable
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 API is experimental and might change in incompatible ways in the next release.
Please make a complete backup of your index before using this to exorcise corrupted documents from your index!
  • Constructor Details

    • CheckIndex

      public CheckIndex(Directory dir) throws IOException
      Create a new CheckIndex on the directory.
      Throws:
      IOException
    • CheckIndex

      public CheckIndex(Directory dir, Lock writeLock)
      Expert: create a directory with the specified lock. This should really not be used except for unit tests!!!! It exists only to support special tests (such as TestIndexWriterExceptions*), that would otherwise be more complicated to debug if they had to close the writer for each check.
  • Method Details