nsoft commented on a change in pull request #504: SOLR-13008 Indent JSON/XML 
formatted field value if indent=true and using DocumentTransformer
URL: https://github.com/apache/lucene-solr/pull/504#discussion_r249488688
 
 

 ##########
 File path: 
solr/core/src/java/org/apache/solr/response/transform/RawValueTransformerFactory.java
 ##########
 @@ -79,7 +84,18 @@ public DocTransformer create(String display, SolrParams 
params, SolrQueryRequest
     }
 
     if(apply) {
-      return new RawTransformer( field, display );
+      boolean indent = req.getParams().getBool("indent", false);
+      ObjectMapper mapper = null;
+      if (indent) {
+        if (applyToWT.equalsIgnoreCase("json")) {
+          mapper = new ObjectMapper();
+        }
+        else {
 
 Review comment:
   There's a log more WT's possible? 
https://lucene.apache.org/solr/guide/7_6/response-writers.html#response-writers 
probably don't want to format all of then as xml, Although I admit I haven't 
yet figured out when applyToWT gets set, this else makes me nervous. Use of a 
switch would seem better, especially if we later want to indent some other 
format (hopefully someday wt=yaml...). Also what about wt=geojson? that's json 
too. (not sure if the existing code handles :[geojson] though...) 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

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

Reply via email to