From 63dfdc0d78568fd1fa7f87b2776da36d1c18e98b Mon Sep 17 00:00:00 2001 From: Ryan McKinley Date: Tue, 15 Jan 2008 21:00:36 +0000 Subject: [PATCH] SOLR-446 -- make sure TextResponseWriter limits fields to returnFields if specified git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@612215 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/solr/request/XMLWriter.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/java/org/apache/solr/request/XMLWriter.java b/src/java/org/apache/solr/request/XMLWriter.java index ecd18c150ce..71de7bfcf4b 100644 --- a/src/java/org/apache/solr/request/XMLWriter.java +++ b/src/java/org/apache/solr/request/XMLWriter.java @@ -342,11 +342,14 @@ final public class XMLWriter { startTag("doc", name, false); incLevel(); - if (includeScore) { - writeVal("score", doc.getFirstValue("score")); + if (includeScore && returnFields != null ) { + returnFields.add( "score" ); } for (String fname : doc.getFieldNames()) { + if (returnFields!=null && !returnFields.contains(fname)) { + continue; + } Object val = doc.getFieldValue(fname); if (val instanceof Collection) {