gerlowskija commented on code in PR #975:
URL: https://github.com/apache/solr/pull/975#discussion_r966024055


##########
solr/core/src/java/org/apache/solr/handler/api/V2ApiUtils.java:
##########
@@ -40,4 +44,41 @@ public static void flattenToCommaDelimitedString(
     final String flattenedStr = String.join(",", toFlatten);
     destination.put(newKey, flattenedStr);
   }
+
+  /**
+   * Convert a JacksonReflectMapWriter (typically a {@link
+   * org.apache.solr.jersey.SolrJerseyResponse}) into the NamedList on a 
SolrQueryResponse
+   *
+   * @param rsp the response to attach the resulting NamedList to
+   * @param mw the input object to be converted into a NamedList
+   * @param trimHeader should the 'responseHeader' portion of the response be 
added to the
+   *     NamedList, or should populating that header be left to code 
elsewhere. This value should
+   *     usually be 'false' when called from v2 code, and 'true' when called 
from v1 code.
+   */
+  public static void squashIntoSolrResponse(
+      SolrQueryResponse rsp, JacksonReflectMapWriter mw, boolean trimHeader) {
+    squashIntoNamedList(rsp.getValues(), mw, trimHeader);
+  }
+
+  public static void squashIntoSolrResponse(SolrQueryResponse rsp, 
JacksonReflectMapWriter mw) {
+    squashIntoSolrResponse(rsp, mw, false);
+  }
+
+  public static void squashIntoNamedList(
+      NamedList<Object> destination, JacksonReflectMapWriter mw) {
+    squashIntoNamedList(destination, mw, false);
+  }
+
+  // TODO Come up with a better approach (maybe change Responses to be based 
on some class that can
+  // natively do this
+  //  without the intermediate map(s)?)

Review Comment:
   Hey, a belated thanks for fixing this; really appreciate it!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org
For additional commands, e-mail: issues-h...@solr.apache.org

Reply via email to