@Override
 public BytesRef binaryValue() {
   final byte[] bytes = new byte[points.size() * 16];
   int off = 0;
   for (Iterator<ObjectCursor<GeoPoint>> it = points.iterator(); it.hasNext(); ) {
     final GeoPoint point = it.next().value;
     ByteUtils.writeDoubleLE(point.getLat(), bytes, off);
     ByteUtils.writeDoubleLE(point.getLon(), bytes, off + 8);
     off += 16;
   }
   return new BytesRef(bytes);
 }
 @Override
 public void setDocument(int docId) {
   bytes = values.get(docId);
   in.reset(bytes.bytes, bytes.offset, bytes.length);
   if (!in.eof()) {
     // first value uses vLong on top of zig-zag encoding, then deltas are encoded using vLong
     long previousValue = longs[0] = ByteUtils.zigZagDecode(ByteUtils.readVLong(in));
     count = 1;
     while (!in.eof()) {
       longs = ArrayUtil.grow(longs, count + 1);
       previousValue = longs[count++] = previousValue + ByteUtils.readVLong(in);
     }
   } else {
     count = 0;
   }
 }
Пример #3
0
    @Override
    public BytesRef binaryValue() {
      CollectionUtils.sortAndDedup(values);

      final byte[] bytes = new byte[values.size() * 8];
      for (int i = 0; i < values.size(); ++i) {
        ByteUtils.writeDoubleLE(values.get(i), bytes, i * 8);
      }
      return new BytesRef(bytes);
    }
 @Override
 public double valueAt(int index) {
   return ByteUtils.readFloatLE(bytes.bytes, bytes.offset + index * 4);
 }