Example usage for org.apache.lucene.store MergeInfo MergeInfo

List of usage examples for org.apache.lucene.store MergeInfo MergeInfo

Introduction

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

Prototype


public MergeInfo(int totalMaxDoc, long estimatedMergeBytes, boolean isExternal, int mergeMaxNumSegments) 

Source Link

Document

Creates a new MergeInfo instance from the values required for a MERGE IOContext context.

Usage

From source file:com.github.lucene.store.database.DatabaseDirectoryITest.java

License:Apache License

private void addContentIndexOutput(final Directory directory, final String fileName, final String content,
        final Context context) throws IOException {
    IOContext ioContext = null;/*  w  ww.  jav a2  s.  co m*/
    switch (context) {
    case FLUSH:
        ioContext = new IOContext(new FlushInfo(1, 1));
        break;
    case MERGE:
        ioContext = new IOContext(new MergeInfo(1, 1, false, 1));
        break;
    default:
        ioContext = new IOContext(context);
        break;
    }
    final IndexOutput indexOutput = directory.createOutput(fileName, ioContext);
    indexOutput.writeString(content);
    indexOutput.close();
}

From source file:org.apache.solr.store.blockcache.BlockDirectoryTest.java

License:Apache License

/**
 * Verify the configuration options for the block cache are handled
 * appropriately./*from   w w  w .  j a  v  a 2  s  . c o  m*/
 */
@Test
public void ensureCacheConfigurable() throws Exception {
    IOContext mergeContext = new IOContext(new MergeInfo(1, 1, false, 1));

    BlockDirectory d = directory;
    assertTrue(d.useReadCache("", IOContext.DEFAULT));
    assertTrue(d.useWriteCache("", IOContext.DEFAULT));
    assertFalse(d.useWriteCache("", mergeContext));

    d = new BlockDirectory("test", directory, mapperCache, null, true, false);
    assertTrue(d.useReadCache("", IOContext.DEFAULT));
    assertFalse(d.useWriteCache("", IOContext.DEFAULT));
    assertFalse(d.useWriteCache("", mergeContext));

    d = new BlockDirectory("test", directory, mapperCache, null, false, true);
    assertFalse(d.useReadCache("", IOContext.DEFAULT));
    assertTrue(d.useWriteCache("", IOContext.DEFAULT));
    assertFalse(d.useWriteCache("", mergeContext));
}