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

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

Introduction

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

Prototype

@Override
    public long get(long index) 

Source Link

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  .j a  v a2 s.  c  om

    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 {/*from  ww w  . java2s  .  c  o  m*/
        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;
        }
    };
}