1

与javalucene api 3.0一起使用时如何解锁索引目录 ?方法不起作用。我是新手?SimpleFsFactoryunlock()lucene

4

1 回答 1

6

我正在这样做,它对我有用:

    Directory directory = FSDirectory.open(folder);
    if (directory.fileExists(IndexWriter.WRITE_LOCK_NAME)) {
        directory.clearLock(IndexWriter.WRITE_LOCK_NAME);
        log.warn("Existing write.lock at [" + folder.getAbsolutePath() + "] has been found and removed. This is a likely result of non-gracefully terminated server. Check for index discrepancies!");
    }
    directory.close();
于 2012-11-21T14:13:30.890 回答