Search in sources :

Example 1 with Status

use of org.apache.lucene.index.CheckIndex.Status in project zm-mailbox by Zimbra.

the class LuceneViewer method doCheck.

private static void doCheck(CommandLine cl) throws Exception {
    Console console = new Console(cl.hasOption(CLI.O_VERBOSE));
    String indexDir = cl.getOptionValue(CLI.O_INPUT);
    console.info("Checking index " + indexDir);
    Directory dir = null;
    try {
        dir = LuceneDirectory.open(new File(indexDir));
    } catch (Throwable t) {
        console.info("ERROR: could not open directory \"" + indexDir + "\"; exiting");
        t.printStackTrace(System.out);
        System.exit(1);
    }
    CheckIndex checker = new CheckIndex(dir);
    checker.setInfoStream(System.out);
    Status result = checker.checkIndex();
    console.info("Result:" + (result.clean ? "clean" : "not clean"));
}
Also used : Status(org.apache.lucene.index.CheckIndex.Status) File(java.io.File) CheckIndex(org.apache.lucene.index.CheckIndex) Directory(org.apache.lucene.store.Directory)

Aggregations

File (java.io.File)1 CheckIndex (org.apache.lucene.index.CheckIndex)1 Status (org.apache.lucene.index.CheckIndex.Status)1 Directory (org.apache.lucene.store.Directory)1