SOLR-7376 - adjusted RawValueTransformerFactoryimpl to use StorableField#stringValue

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1673731 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Tommaso Teofili 2015-04-15 11:29:02 +00:00
parent d71933415d
commit 06a1248a4d
1 changed files with 9 additions and 8 deletions

View File

@ -21,6 +21,7 @@ import java.util.ArrayList;
import java.util.Collection;
import org.apache.lucene.index.IndexableField;
import org.apache.lucene.index.StorableField;
import org.apache.solr.common.SolrDocument;
import org.apache.solr.common.params.CommonParams;
import org.apache.solr.common.params.SolrParams;
@ -135,14 +136,14 @@ public class RawValueTransformerFactory extends TransformerFactory
@Override
public void write(String name, TextResponseWriter writer) throws IOException {
// String str = null;
// if(val instanceof IndexableField) { // delays holding it in memory
// str = ((IndexableField)val).stringValue();
// }
// else {
// str = val.toString();
// }
writer.getWriter().write(val.toString());
String str = null;
if(val instanceof StorableField) { // delays holding it in memory
str = ((StorableField)val).stringValue();
}
else {
str = val.toString();
}
writer.getWriter().write(str);
}
@Override