Example usage for org.apache.lucene.util NumericUtils longToSortableBytes

List of usage examples for org.apache.lucene.util NumericUtils longToSortableBytes

Introduction

In this page you can find the example usage for org.apache.lucene.util NumericUtils longToSortableBytes.

Prototype

public static void longToSortableBytes(long value, byte[] result, int offset) 

Source Link

Document

Encodes an long value such that unsigned byte order comparison is consistent with Long#compare(long,long)

Usage

From source file:com.b2international.index.lucene.LongIndexField.java

License:Apache License

@Override
protected BytesRef toBytesRef(Long value) {
    byte[] packed = new byte[Long.BYTES];
    NumericUtils.longToSortableBytes(value, packed, 0);
    return new BytesRef(packed);
}

From source file:org.elasticsearch.index.mapper.BinaryRangeUtil.java

License:Apache License

static byte[] encodeDouble(double number) {
    byte[] encoded = new byte[8];
    NumericUtils.longToSortableBytes(NumericUtils.doubleToSortableLong(number), encoded, 0);
    return encoded;
}