@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.toExternal(new Date(NumericUtils.prefixCodedToLong(indexedForm))); default: throw new SolrException( SolrException.ErrorCode.SERVER_ERROR, "Unknown type for trie field: " + type); } }
@Override public String toExternal(Fieldable f) { return (type == TrieTypes.DATE) ? dateField.toExternal((Date) toObject(f)) : toObject(f).toString(); }