mirror of
https://github.com/apache/lucene.git
synced 2025-02-09 11:35:14 +00:00
remove extra array allocation
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1180469 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
bee60b6144
commit
a2936360e9
@ -368,27 +368,29 @@ public class TrieField extends org.apache.solr.schema.FieldType {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CharsRef indexedToReadable(BytesRef indexedForm, CharsRef charsRef) {
|
public CharsRef indexedToReadable(BytesRef indexedForm, CharsRef charsRef) {
|
||||||
final char[] value;
|
final String value;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case INTEGER:
|
case INTEGER:
|
||||||
value = Integer.toString( NumericUtils.prefixCodedToInt(indexedForm) ).toCharArray();
|
value = Integer.toString( NumericUtils.prefixCodedToInt(indexedForm) );
|
||||||
break;
|
break;
|
||||||
case FLOAT:
|
case FLOAT:
|
||||||
value = Float.toString( NumericUtils.sortableIntToFloat(NumericUtils.prefixCodedToInt(indexedForm)) ).toCharArray();
|
value = Float.toString( NumericUtils.sortableIntToFloat(NumericUtils.prefixCodedToInt(indexedForm)) );
|
||||||
break;
|
break;
|
||||||
case LONG:
|
case LONG:
|
||||||
value = Long.toString( NumericUtils.prefixCodedToLong(indexedForm) ).toCharArray();
|
value = Long.toString( NumericUtils.prefixCodedToLong(indexedForm) );
|
||||||
break;
|
break;
|
||||||
case DOUBLE:
|
case DOUBLE:
|
||||||
value = Double.toString( NumericUtils.sortableLongToDouble(NumericUtils.prefixCodedToLong(indexedForm)) ).toCharArray();
|
value = Double.toString( NumericUtils.sortableLongToDouble(NumericUtils.prefixCodedToLong(indexedForm)) );
|
||||||
break;
|
break;
|
||||||
case DATE:
|
case DATE:
|
||||||
value = dateField.toExternal( new Date(NumericUtils.prefixCodedToLong(indexedForm)) ).toCharArray();
|
value = dateField.toExternal( new Date(NumericUtils.prefixCodedToLong(indexedForm)) );
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "Unknown type for trie field: " + type);
|
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "Unknown type for trie field: " + type);
|
||||||
}
|
}
|
||||||
charsRef.copy(value, 0, value.length);
|
charsRef.grow(value.length());
|
||||||
|
charsRef.length = value.length();
|
||||||
|
value.getChars(0, charsRef.length, charsRef.chars, 0);
|
||||||
return charsRef;
|
return charsRef;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user