Example usage for org.apache.lucene.util.packed BlockPackedReader BlockPackedReader

List of usage examples for org.apache.lucene.util.packed BlockPackedReader BlockPackedReader

Introduction

In this page you can find the example usage for org.apache.lucene.util.packed BlockPackedReader BlockPackedReader.

Prototype

public BlockPackedReader(IndexInput in, int packedIntsVersion, int blockSize, long valueCount, boolean direct)
        throws IOException 

Source Link

Document

Sole constructor.

Usage

From source file:org.apache.blur.lucene.codec.DiskDocValuesProducer.java

License:Apache License

LongNumericDocValues getNumeric(NumericEntry entry) throws IOException {
    final IndexInput data = this.data.clone();
    data.seek(entry.offset);/*from ww  w.  java 2  s  .  com*/

    final BlockPackedReader reader = new BlockPackedReader(data, entry.packedIntsVersion, entry.blockSize,
            entry.count, true);
    return new LongNumericDocValues() {
        @Override
        public long get(long id) {
            return reader.get(id);
        }
    };
}

From source file:org.apache.blur.lucene.codec.DiskDocValuesProducer.java

License:Apache License

@Override
public SortedDocValues getSorted(FieldInfo field) throws IOException {
    final int valueCount = (int) binaries.get(field.number).count;
    final BinaryDocValues binary = getBinary(field);
    Tracer trace = Trace.trace("getSorted - BlockPackedReader - create");
    final BlockPackedReader ordinals;
    try {// w ww .  j a v  a2  s  .  com
        NumericEntry entry = ords.get(field.number);
        IndexInput data = this.data.clone();
        data.seek(entry.offset);
        ordinals = new BlockPackedReader(data, entry.packedIntsVersion, entry.blockSize, entry.count, true);
    } finally {
        trace.done();
    }
    return new SortedDocValues() {

        @Override
        public int getOrd(int docID) {
            return (int) ordinals.get(docID);
        }

        @Override
        public void lookupOrd(int ord, BytesRef result) {
            binary.get(ord, result);
        }

        @Override
        public int getValueCount() {
            return valueCount;
        }
    };
}