/** Decode single float dimension */ public static float decodeDimension(byte value[], int offset) { return NumericUtils.sortableIntToFloat(NumericUtils.sortableBytesToInt(value, offset)); }
/** decodes the max value (for the defined dimension) from the encoded input byte array */ static float decodeMax(byte[] b, int dimension) { int offset = b.length/2 + dimension*BYTES; return NumericUtils.sortableIntToFloat(NumericUtils.sortableBytesToInt(b, offset)); }
/** decodes the min value (for the defined dimension) from the encoded input byte array */ static float decodeMin(byte[] b, int dimension) { int offset = dimension*BYTES; return NumericUtils.sortableIntToFloat(NumericUtils.sortableBytesToInt(b, offset)); }
@Override public double doubleValue() throws IOException { return NumericUtils.sortableIntToFloat((int) in.longValue()); }
@Override public double nextValue() throws IOException { return NumericUtils.sortableIntToFloat((int) in.nextValue()); }
@Override final public Float to(final BytesRef bytesRef) { if (isEmpty(bytesRef)) return null; checkByteSize(bytesRef, Float.BYTES, "Cannot convert value to float"); return NumericUtils.sortableIntToFloat(NumericUtils.sortableBytesToInt(bytesRef.bytes, 0)); } }
@Override final public float[] convert(final int docId) throws IOException { final long[] sources = reader.getSortedNumericDocValues(docId, field); final float[] set = new float[sources.length]; for (int i = 0; i < set.length; i++) set[i] = NumericUtils.sortableIntToFloat((int) sources[i]); return set; }
@Override public double doubleValue() throws IOException { return NumericUtils.sortableIntToFloat((int) in.longValue()); }
@Override public double nextValue() throws IOException { return NumericUtils.sortableIntToFloat((int) in.nextValue()); }
@Override public double valueAt(int index) { return NumericUtils.sortableIntToFloat((int) in.valueAt(index)); }
/** decodes the max value (for the defined dimension) from the encoded input byte array */ static float decodeMax(byte[] b, int dimension) { int offset = b.length/2 + dimension*BYTES; return NumericUtils.sortableIntToFloat(NumericUtils.sortableBytesToInt(b, offset)); }
@Override final public void collect(final int doc) { count++; final float value = NumericUtils.sortableIntToFloat((int) docValues.get(doc)); if (value < result) result = value; } }
@Override final public void collect(final int doc) { count++; final float value = NumericUtils.sortableIntToFloat((int) docValues.get(doc)); if (value > result) result = value; } }
/** decodes the min value (for the defined dimension) from the encoded input byte array */ static float decodeMin(byte[] b, int dimension) { int offset = dimension*BYTES; return NumericUtils.sortableIntToFloat(NumericUtils.sortableBytesToInt(b, offset)); }
@Override public double get(int docID) { return NumericUtils.sortableIntToFloat((int) in.get(docID)); } }
@Override public Number toNumber(BytesRef indexForm) { return NumericUtils.sortableIntToFloat(NumericUtils.prefixCodedToInt(indexForm)); } },
@Override public double get(int docID) { return NumericUtils.sortableIntToFloat((int) in.get(docID)); } }
/** Decode single float dimension */ public static float decodeDimension(byte value[], int offset) { return NumericUtils.sortableIntToFloat(NumericUtils.sortableBytesToInt(value, offset)); }
@Override public double doubleValue() throws IOException { return NumericUtils.sortableIntToFloat((int) in.longValue()); }
@Override public FieldStats stats(Terms terms, int maxDoc) throws IOException { float minValue = NumericUtils.sortableIntToFloat(NumericUtils.getMinInt(terms)); float maxValue = NumericUtils.sortableIntToFloat(NumericUtils.getMaxInt(terms)); return new FieldStats.Float( maxDoc, terms.getDocCount(), terms.getSumDocFreq(), terms.getSumTotalTermFreq(), minValue, maxValue ); } }