Skip to content

Apache Lucene open-source search software

SOLR-12333: drop redundant lines in JSON response writers

Mikhail Khludnevd020ba84e432
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 798c3df1c7f..93dca4379a3 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -252,6 +252,8 @@ Optimizations
* SOLR-12312: Replication IndexFetcher should cap its internal buffer size when the file being transferred is small.
(Jeff Miller, David Smiley)
+* SOLR-12333: Removed redundant lines for handling lists in JSON reponse writers. (David Smiley via Mikhail Khludnev)
+
Other Changes
----------------------
diff --git a/solr/core/src/java/org/apache/solr/response/GeoJSONResponseWriter.java b/solr/core/src/java/org/apache/solr/response/GeoJSONResponseWriter.java
index 012290eb5df..90b20ffb9ef 100644
--- a/solr/core/src/java/org/apache/solr/response/GeoJSONResponseWriter.java
+++ b/solr/core/src/java/org/apache/solr/response/GeoJSONResponseWriter.java
@@ -163,16 +163,7 @@ class GeoJSONWriter extends JSONWriter {
indent();
writeKey(fname, true);
val = doc.getFieldValue(fname);
-
- // SolrDocument will now have multiValued fields represented as a Collection,
- // even if only a single value is returned for this document.
- // For SolrDocumentList, use writeVal instead of writeArray
- if (!(val instanceof SolrDocumentList) && val instanceof List) {
- // shortcut this common case instead of going through writeVal again
- writeArray(name,((Iterable)val).iterator());
- } else {
- writeVal(fname, val);
- }
+ writeVal(fname, val);
}
// GeoJSON does not really support nested FeatureCollections
diff --git a/solr/core/src/java/org/apache/solr/response/JSONResponseWriter.java b/solr/core/src/java/org/apache/solr/response/JSONResponseWriter.java
index 5f6e2f27bc4..409802c90a6 100644
--- a/solr/core/src/java/org/apache/solr/response/JSONResponseWriter.java
+++ b/solr/core/src/java/org/apache/solr/response/JSONResponseWriter.java
@@ -29,7 +29,6 @@ import org.apache.solr.common.MapWriter;
import org.apache.solr.common.MapWriter.EntryWriter;
import org.apache.solr.common.PushWriter;
import org.apache.solr.common.SolrDocument;
-import org.apache.solr.common.SolrDocumentList;
import org.apache.solr.common.params.SolrParams;
import org.apache.solr.common.util.NamedList;
import org.apache.solr.common.util.SimpleOrderedMap;
@@ -365,16 +364,7 @@ class JSONWriter extends TextResponseWriter {
indent();
writeKey(fname, true);
Object val = doc.getFieldValue(fname);
-
- // SolrDocument will now have multiValued fields represented as a Collection,
- // even if only a single value is returned for this document.
- // For SolrDocumentList, use writeVal instead of writeArray
- if (!(val instanceof SolrDocumentList) && val instanceof List) {
- // shortcut this common case instead of going through writeVal again
- writeArray(name,((Iterable)val).iterator());
- } else {
- writeVal(fname, val);
- }
+ writeVal(fname, val);
}
if(doc.hasChildDocuments()) {