@Override public long parseValue(BytesRef term) { return NumericUtils.prefixCodedToInt(term); }
@Override public long parseValue(BytesRef term) { return NumericUtils.prefixCodedToInt(term); }
@Override public long toLong(BytesRef indexForm) { return NumericUtils.prefixCodedToInt(indexForm); }
@Override public long parseValue(BytesRef term) { int val = NumericUtils.prefixCodedToInt(term); if (val<0) val ^= 0x7fffffff; return val; }
@Override public long parseValue(BytesRef term) { int val = NumericUtils.prefixCodedToInt(term); if (val<0) val ^= 0x7fffffff; return val; }
@Override public Number toNumber(BytesRef indexForm) { return NumericUtils.prefixCodedToInt(indexForm); } },
/** * Returns the minimum int value indexed into this * numeric field or null if no terms exist. */ public static Integer getMinInt(Terms terms) throws IOException { // All shift=0 terms are sorted first, so we don't need // to filter the incoming terms; we can just get the // min: BytesRef min = terms.getMin(); return (min != null) ? NumericUtils.prefixCodedToInt(min) : null; }
/** * Returns the minimum int value indexed into this * numeric field or null if no terms exist. */ public static Integer getMinInt(Terms terms) throws IOException { // All shift=0 terms are sorted first, so we don't need // to filter the incoming terms; we can just get the // min: BytesRef min = terms.getMin(); return (min != null) ? NumericUtils.prefixCodedToInt(min) : null; }
@Override public Number toNumber(BytesRef indexForm) { return NumericUtils.sortableIntToFloat(NumericUtils.prefixCodedToInt(indexForm)); } },
@Override public double toDouble(BytesRef indexForm) { return NumericUtils.sortableIntToFloat(NumericUtils.prefixCodedToInt(indexForm)); }
@Override public void consume(final BytesRef ref) throws Exception { //check both ref length and data type before consuming the ref value if(ref.length == NumericUtils.BUF_SIZE_LONG && _dataType == Constants.FIELD_DATA_TYPE.LONG) { _strings[_ptr++] = Long.toString(NumericUtils.prefixCodedToLong(ref)); } else if(ref.length == NumericUtils.BUF_SIZE_INT && _dataType == Constants.FIELD_DATA_TYPE.INT) { _strings[_ptr++] = Integer.toString(NumericUtils.prefixCodedToInt(ref)); } else _strings[_ptr++] = ref.utf8ToString(); }
/** * Returns the maximum int value indexed into this * numeric field or null if no terms exist. */ public static Integer getMaxInt(Terms terms) throws IOException { BytesRef max = intTerms(terms).getMax(); return (max != null) ? NumericUtils.prefixCodedToInt(max) : null; }
/** * Returns the maximum int value indexed into this * numeric field or null if no terms exist. */ public static Integer getMaxInt(Terms terms) throws IOException { BytesRef max = intTerms(terms).getMax(); return (max != null) ? NumericUtils.prefixCodedToInt(max) : null; }
void dump(PrintStream out){ out.println(field+":"); final BytesRef ref = new BytesRef(); for (int i = 0; i < terms.size(); i++) { terms.get(ords[i], ref); out.print(ref+" "+ref.utf8ToString()+" "); try { out.print(Long.toHexString(NumericUtils.prefixCodedToLong(ref))+"L"); } catch (Exception e) { try { out.print(Integer.toHexString(NumericUtils.prefixCodedToInt(ref))+"i"); } catch (Exception ee) { } } out.println(" score="+scores[ords[i]]); out.println(""); } } }
@Override public String indexedToReadable(String indexedForm) { switch (type) { case INTEGER: return Integer.toString( NumericUtils.prefixCodedToInt(indexedForm) ); case FLOAT: return Float.toString( NumericUtils.sortableIntToFloat(NumericUtils.prefixCodedToInt(indexedForm)) ); case LONG: return Long.toString( NumericUtils.prefixCodedToLong(indexedForm) ); case DOUBLE: return Double.toString( NumericUtils.sortableLongToDouble(NumericUtils.prefixCodedToLong(indexedForm)) ); case DATE: return dateField.formatDate( new Date(NumericUtils.prefixCodedToLong(indexedForm)) ); default: throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "Unknown type for trie field: " + type); } }
while ((term = iter.next()) != null) { values = BigArrays.NON_RECYCLING_INSTANCE.grow(values, numTerms + 1); values.set(numTerms++, NumericUtils.sortableIntToFloat(NumericUtils.prefixCodedToInt(term)));