Example usage for org.apache.lucene.store BaseDirectoryWrapper setCheckIndexOnClose

List of usage examples for org.apache.lucene.store BaseDirectoryWrapper setCheckIndexOnClose

Introduction

In this page you can find the example usage for org.apache.lucene.store BaseDirectoryWrapper setCheckIndexOnClose.

Prototype

public void setCheckIndexOnClose(boolean value) 

Source Link

Document

Set whether or not checkindex should be run on close

Usage

From source file:org.elasticsearch.indices.recovery.RecoverySourceHandlerTests.java

License:Apache License

private Store newStore(Path path, boolean checkIndex) throws IOException {
    DirectoryService directoryService = new DirectoryService(shardId, INDEX_SETTINGS) {
        @Override//from  w w w.  j  a  v a2  s . c  o  m
        public long throttleTimeInNanos() {
            return 0;
        }

        @Override
        public Directory newDirectory() throws IOException {
            BaseDirectoryWrapper baseDirectoryWrapper = RecoverySourceHandlerTests.newFSDirectory(path);
            if (checkIndex == false) {
                baseDirectoryWrapper.setCheckIndexOnClose(false); // don't run checkindex we might corrupt the index in these tests
            }
            return baseDirectoryWrapper;
        }
    };
    return new Store(shardId, INDEX_SETTINGS, directoryService, new DummyShardLock(shardId));
}