Example usage for org.apache.lucene.codecs.blocktree BlockTreeTermsWriter BlockTreeTermsWriter

List of usage examples for org.apache.lucene.codecs.blocktree BlockTreeTermsWriter BlockTreeTermsWriter

Introduction

In this page you can find the example usage for org.apache.lucene.codecs.blocktree BlockTreeTermsWriter BlockTreeTermsWriter.

Prototype

public BlockTreeTermsWriter(SegmentWriteState state, PostingsWriterBase postingsWriter, int minItemsInBlock,
        int maxItemsInBlock) throws IOException 

Source Link

Document

Create a new writer.

Usage

From source file:com.lucure.core.codec.LucurePostingsFormat.java

License:Apache License

@Override
public FieldsConsumer fieldsConsumer(SegmentWriteState state) throws IOException {
    PostingsWriterBase postingsWriter = new Lucene41PostingsWriter(state);

    boolean success = false;
    try {//from  w  w w.j a v a  2s  .c om
        FieldsConsumer ret = new BlockTreeTermsWriter(state, postingsWriter, minTermBlockSize,
                maxTermBlockSize);
        success = true;
        return new LucureMergingFieldsConsumer(ret);
    } finally {
        if (!success) {
            IOUtils.closeWhileHandlingException(postingsWriter);
        }
    }
}

From source file:com.rocana.lucene.codec.v1.RocanaLucene50PostingsFormat.java

License:Apache License

@Override
public FieldsConsumer fieldsConsumer(SegmentWriteState state) throws IOException {
    PostingsWriterBase postingsWriter = new Lucene50PostingsWriter(state);

    boolean success = false;
    try {/*from w w w .  j a  va 2 s .  c o m*/
        FieldsConsumer ret = new BlockTreeTermsWriter(state, postingsWriter, minTermBlockSize,
                maxTermBlockSize);
        success = true;
        return ret;
    } finally {
        if (!success) {
            IOUtils.closeWhileHandlingException(postingsWriter);
        }
    }
}

From source file:com.sindicetech.siren.index.codecs.siren10.Siren10PostingsFormat.java

License:Open Source License

@Override
public FieldsConsumer fieldsConsumer(final SegmentWriteState state) throws IOException {
    final PostingsWriterBase postingsWriter = new Siren10PostingsWriter(state, this.getFactory());

    boolean success = false;
    try {/*w w  w  .java2s  .  com*/
        final FieldsConsumer ret = new BlockTreeTermsWriter(state, postingsWriter,
                BlockTreeTermsWriter.DEFAULT_MIN_BLOCK_SIZE, BlockTreeTermsWriter.DEFAULT_MAX_BLOCK_SIZE);
        success = true;
        return ret;
    } finally {
        if (!success) {
            postingsWriter.close();
        }
    }
}