You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-dev@lucene.apache.org by "Uri Boness (JIRA)" <ji...@apache.org> on 2009/04/22 14:18:47 UTC

[jira] Created: (SOLR-1123) Change the JSONResponseWriter content type

Change the JSONResponseWriter content type
------------------------------------------

                 Key: SOLR-1123
                 URL: https://issues.apache.org/jira/browse/SOLR-1123
             Project: Solr
          Issue Type: Improvement
    Affects Versions: 1.3
            Reporter: Uri Boness
             Fix For: 1.3.1


Currently the jSON content type is not used. Instead the palin/text content type is used. The reason for this as I understand is to enable viewing the json response as as text in the browser. While this is valid argument, I do believe that there should at least be an option to configure this writer to use the JSON content type. According to [RFC4627|http://www.ietf.org/rfc/rfc4627.txt] the json content type needs to be application/json (and not text/x-json). The reason this can be very helpful is that today you have plugins for browsers (e.g. [JSONView|http://brh.numbera.com/software/jsonview]) that can render any page with application/json content type in a user friendly manner (just like xml is supported).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SOLR-1123) Change the JSONResponseWriter content type

Posted by "Yonik Seeley (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-1123?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12711122#action_12711122 ] 

Yonik Seeley commented on SOLR-1123:
------------------------------------

Is there perhaps a more general feature we could turn this into?  An expert level ability or parameter to set a custom content-type?

> Change the JSONResponseWriter content type
> ------------------------------------------
>
>                 Key: SOLR-1123
>                 URL: https://issues.apache.org/jira/browse/SOLR-1123
>             Project: Solr
>          Issue Type: Improvement
>            Reporter: Uri Boness
>             Fix For: 1.5
>
>         Attachments: JSON_contentType_incl_tests.patch
>
>
> Currently the jSON content type is not used. Instead the palin/text content type is used. The reason for this as I understand is to enable viewing the json response as as text in the browser. While this is valid argument, I do believe that there should at least be an option to configure this writer to use the JSON content type. According to [RFC4627|http://www.ietf.org/rfc/rfc4627.txt] the json content type needs to be application/json (and not text/x-json). The reason this can be very helpful is that today you have plugins for browsers (e.g. [JSONView|http://brh.numbera.com/software/jsonview]) that can render any page with application/json content type in a user friendly manner (just like xml is supported).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SOLR-1123) Change the JSONResponseWriter content type

Posted by "Yonik Seeley (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-1123?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12789915#action_12789915 ] 

Yonik Seeley commented on SOLR-1123:
------------------------------------

I never got a chance to check out SOLR-1516, but my understanding was that it was a response writer that made it easy for custom response writers to inherit from?  I'm not sure we should introduce that as a dependency for the standard response writers.

> Change the JSONResponseWriter content type
> ------------------------------------------
>
>                 Key: SOLR-1123
>                 URL: https://issues.apache.org/jira/browse/SOLR-1123
>             Project: Solr
>          Issue Type: Improvement
>            Reporter: Uri Boness
>             Fix For: 1.5
>
>         Attachments: JSON_contentType_incl_tests.patch
>
>
> Currently the jSON content type is not used. Instead the palin/text content type is used. The reason for this as I understand is to enable viewing the json response as as text in the browser. While this is valid argument, I do believe that there should at least be an option to configure this writer to use the JSON content type. According to [RFC4627|http://www.ietf.org/rfc/rfc4627.txt] the json content type needs to be application/json (and not text/x-json). The reason this can be very helpful is that today you have plugins for browsers (e.g. [JSONView|http://brh.numbera.com/software/jsonview]) that can render any page with application/json content type in a user friendly manner (just like xml is supported).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SOLR-1123) Change the JSONResponseWriter content type

Posted by "Noble Paul (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-1123?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12789916#action_12789916 ] 

Noble Paul commented on SOLR-1123:
----------------------------------

SOLR-1516 has the potential to simplify our existing responsewriters . 

> Change the JSONResponseWriter content type
> ------------------------------------------
>
>                 Key: SOLR-1123
>                 URL: https://issues.apache.org/jira/browse/SOLR-1123
>             Project: Solr
>          Issue Type: Improvement
>            Reporter: Uri Boness
>             Fix For: 1.5
>
>         Attachments: JSON_contentType_incl_tests.patch
>
>
> Currently the jSON content type is not used. Instead the palin/text content type is used. The reason for this as I understand is to enable viewing the json response as as text in the browser. While this is valid argument, I do believe that there should at least be an option to configure this writer to use the JSON content type. According to [RFC4627|http://www.ietf.org/rfc/rfc4627.txt] the json content type needs to be application/json (and not text/x-json). The reason this can be very helpful is that today you have plugins for browsers (e.g. [JSONView|http://brh.numbera.com/software/jsonview]) that can render any page with application/json content type in a user friendly manner (just like xml is supported).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SOLR-1123) Change the JSONResponseWriter content type

Posted by "Uri Boness (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-1123?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12711133#action_12711133 ] 

Uri Boness commented on SOLR-1123:
----------------------------------

I think that would be the best option. The problem right now is in the current class hierarchy of the response writers. Basically, I think the QueryResponseWriter interface should change to:

{code}
public interface QueryResponseWriter extends NamedListInitializedPlugin {
 
  public void write(OutputStream out, SolrQueryRequest request, SolrQueryResponse response) throws IOException;

  public String getContentType(SolrQueryRequest request, SolrQueryResponse response);

}
{code}

Note: this interface will play nicer with the binary response writer

Then we can have an AbstractTextResponseWriter which will serve as a parent for all non-binary response writers:

{code}
public abstract class AbstractTextResponseWriter extends NamedListInitializedPlugin {

  public final static String CONTENT_TYPE_PARAM = "contentType";
  public static String DEFAULT_CONTENT_TYPE="text/plain; charset=UTF-8";
  
  private final String contentType;
  
  protected AbstractTextResponseWriter() {
    this(DEFAULT_CONTENT_TYPE);
  }

  protected AbstractTextResponseWriter(String defaultContentType) {
    this.contentType = defaultContentType;
  }

  public void init(NamedList args) {
    String configuredContentType = (String) args.get(CONTENT_TYPE_PARAM);
    if (configuredContentType != null) {
      contentType = configuredContentType;;
    }
  }

  public String getContentType(SolrQueryRequest request, SolrQueryResponse response) {
    return contentType;
  }
 
  public final void write(OutputStream out, SolrQueryRequest request, SolrQueryResponse response) throws IOException {
    OutputStreamWriter writer = new OutputStreamWriter(out, "UTF-8");
    write(writer, request, response);
  }

  protected abstract void write(Writer writer, SolrQueryRequest request, SolrQueryResponse response) throws IOException;

}
{code}

This will make it easy for every response writer to define its default content type, yet it will still allow to override this default using the "contentType" parameter in solrconfig. (I assume here that there's no need to customize the content type for the binary response writer as it's internal and specific for the current implementation).

> Change the JSONResponseWriter content type
> ------------------------------------------
>
>                 Key: SOLR-1123
>                 URL: https://issues.apache.org/jira/browse/SOLR-1123
>             Project: Solr
>          Issue Type: Improvement
>            Reporter: Uri Boness
>             Fix For: 1.5
>
>         Attachments: JSON_contentType_incl_tests.patch
>
>
> Currently the jSON content type is not used. Instead the palin/text content type is used. The reason for this as I understand is to enable viewing the json response as as text in the browser. While this is valid argument, I do believe that there should at least be an option to configure this writer to use the JSON content type. According to [RFC4627|http://www.ietf.org/rfc/rfc4627.txt] the json content type needs to be application/json (and not text/x-json). The reason this can be very helpful is that today you have plugins for browsers (e.g. [JSONView|http://brh.numbera.com/software/jsonview]) that can render any page with application/json content type in a user friendly manner (just like xml is supported).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SOLR-1123) Change the JSONResponseWriter content type

Posted by "Shalin Shekhar Mangar (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-1123?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12711136#action_12711136 ] 

Shalin Shekhar Mangar commented on SOLR-1123:
---------------------------------------------

Or we could just add a request parameter and SolrDispatchFilter can set the value of the param if it is present.

> Change the JSONResponseWriter content type
> ------------------------------------------
>
>                 Key: SOLR-1123
>                 URL: https://issues.apache.org/jira/browse/SOLR-1123
>             Project: Solr
>          Issue Type: Improvement
>            Reporter: Uri Boness
>             Fix For: 1.5
>
>         Attachments: JSON_contentType_incl_tests.patch
>
>
> Currently the jSON content type is not used. Instead the palin/text content type is used. The reason for this as I understand is to enable viewing the json response as as text in the browser. While this is valid argument, I do believe that there should at least be an option to configure this writer to use the JSON content type. According to [RFC4627|http://www.ietf.org/rfc/rfc4627.txt] the json content type needs to be application/json (and not text/x-json). The reason this can be very helpful is that today you have plugins for browsers (e.g. [JSONView|http://brh.numbera.com/software/jsonview]) that can render any page with application/json content type in a user friendly manner (just like xml is supported).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Issue Comment Edited: (SOLR-1123) Change the JSONResponseWriter content type

Posted by "Shalin Shekhar Mangar (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-1123?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12711136#action_12711136 ] 

Shalin Shekhar Mangar edited comment on SOLR-1123 at 5/20/09 6:17 AM:
----------------------------------------------------------------------

Or we could just add a request parameter and SolrDispatchFilter can set the value of the param as the content type.

      was (Author: shalinmangar):
    Or we could just add a request parameter and SolrDispatchFilter can set the value of the param if it is present.
  
> Change the JSONResponseWriter content type
> ------------------------------------------
>
>                 Key: SOLR-1123
>                 URL: https://issues.apache.org/jira/browse/SOLR-1123
>             Project: Solr
>          Issue Type: Improvement
>            Reporter: Uri Boness
>             Fix For: 1.5
>
>         Attachments: JSON_contentType_incl_tests.patch
>
>
> Currently the jSON content type is not used. Instead the palin/text content type is used. The reason for this as I understand is to enable viewing the json response as as text in the browser. While this is valid argument, I do believe that there should at least be an option to configure this writer to use the JSON content type. According to [RFC4627|http://www.ietf.org/rfc/rfc4627.txt] the json content type needs to be application/json (and not text/x-json). The reason this can be very helpful is that today you have plugins for browsers (e.g. [JSONView|http://brh.numbera.com/software/jsonview]) that can render any page with application/json content type in a user friendly manner (just like xml is supported).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (SOLR-1123) Change the JSONResponseWriter content type

Posted by "Shalin Shekhar Mangar (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SOLR-1123?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Shalin Shekhar Mangar updated SOLR-1123:
----------------------------------------

    Affects Version/s:     (was: 1.3)
        Fix Version/s:     (was: 1.3.1)
                       1.5

Marking for 1.5

I'm -0 on this. I'm not sure if this inconvenience is big enough to warrant adding a request parameter. I'll let others decide this one.

> Change the JSONResponseWriter content type
> ------------------------------------------
>
>                 Key: SOLR-1123
>                 URL: https://issues.apache.org/jira/browse/SOLR-1123
>             Project: Solr
>          Issue Type: Improvement
>            Reporter: Uri Boness
>             Fix For: 1.5
>
>         Attachments: JSON_contentType_incl_tests.patch
>
>
> Currently the jSON content type is not used. Instead the palin/text content type is used. The reason for this as I understand is to enable viewing the json response as as text in the browser. While this is valid argument, I do believe that there should at least be an option to configure this writer to use the JSON content type. According to [RFC4627|http://www.ietf.org/rfc/rfc4627.txt] the json content type needs to be application/json (and not text/x-json). The reason this can be very helpful is that today you have plugins for browsers (e.g. [JSONView|http://brh.numbera.com/software/jsonview]) that can render any page with application/json content type in a user friendly manner (just like xml is supported).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SOLR-1123) Change the JSONResponseWriter content type

Posted by "Noble Paul (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-1123?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12789912#action_12789912 ] 

Noble Paul commented on SOLR-1123:
----------------------------------

Should we make responsewriters use the GenericTextResponseWriter SOLR-1516?

> Change the JSONResponseWriter content type
> ------------------------------------------
>
>                 Key: SOLR-1123
>                 URL: https://issues.apache.org/jira/browse/SOLR-1123
>             Project: Solr
>          Issue Type: Improvement
>            Reporter: Uri Boness
>             Fix For: 1.5
>
>         Attachments: JSON_contentType_incl_tests.patch
>
>
> Currently the jSON content type is not used. Instead the palin/text content type is used. The reason for this as I understand is to enable viewing the json response as as text in the browser. While this is valid argument, I do believe that there should at least be an option to configure this writer to use the JSON content type. According to [RFC4627|http://www.ietf.org/rfc/rfc4627.txt] the json content type needs to be application/json (and not text/x-json). The reason this can be very helpful is that today you have plugins for browsers (e.g. [JSONView|http://brh.numbera.com/software/jsonview]) that can render any page with application/json content type in a user friendly manner (just like xml is supported).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SOLR-1123) Change the JSONResponseWriter content type

Posted by "Uri Boness (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-1123?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12789922#action_12789922 ] 

Uri Boness commented on SOLR-1123:
----------------------------------

I think the main issue with the inheritance right now is that the QueryResponseWriter interface is dealing with a Writer rather than with an OutputStream. This accounts for the hacky GenericBinaryResponseWriter. 

Looking at SOLR-1516 I'm a bit confused. I always had the impression that the main idea behind the response writers is that all they need to know is how to marshal a NamedList (so they don't need explicit knowledge of documents, highlighting, etc...). But now the GenericTextResponseWriter knows about documents (via the SingleResponseWriter). But perhaps I just go it wrong.

> Change the JSONResponseWriter content type
> ------------------------------------------
>
>                 Key: SOLR-1123
>                 URL: https://issues.apache.org/jira/browse/SOLR-1123
>             Project: Solr
>          Issue Type: Improvement
>            Reporter: Uri Boness
>             Fix For: 1.5
>
>         Attachments: JSON_contentType_incl_tests.patch
>
>
> Currently the jSON content type is not used. Instead the palin/text content type is used. The reason for this as I understand is to enable viewing the json response as as text in the browser. While this is valid argument, I do believe that there should at least be an option to configure this writer to use the JSON content type. According to [RFC4627|http://www.ietf.org/rfc/rfc4627.txt] the json content type needs to be application/json (and not text/x-json). The reason this can be very helpful is that today you have plugins for browsers (e.g. [JSONView|http://brh.numbera.com/software/jsonview]) that can render any page with application/json content type in a user friendly manner (just like xml is supported).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SOLR-1123) Change the JSONResponseWriter content type

Posted by "Lance Norskog (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-1123?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12793424#action_12793424 ] 

Lance Norskog commented on SOLR-1123:
-------------------------------------

It should be possible to pass an arbitrary set of parameters to a ResponseWriter. I added this feature to XSLTResponseWriter in a patch; it made it possible to genericize XSL scripts.

[SOLR-1354|https://issues.apache.org/jira/browse/SOLR-1354]

Since 'tr' chooses the XSLT script, I made 'tr.param=x' pass 'param=x' into the XSL interpreter. 'tr.mime-type=application/json' would be used by the JSON interpreter.

I did not have to change anything outside of XSLTResponseWriter.

> Change the JSONResponseWriter content type
> ------------------------------------------
>
>                 Key: SOLR-1123
>                 URL: https://issues.apache.org/jira/browse/SOLR-1123
>             Project: Solr
>          Issue Type: Improvement
>            Reporter: Uri Boness
>             Fix For: 1.5
>
>         Attachments: JSON_contentType_incl_tests.patch
>
>
> Currently the jSON content type is not used. Instead the palin/text content type is used. The reason for this as I understand is to enable viewing the json response as as text in the browser. While this is valid argument, I do believe that there should at least be an option to configure this writer to use the JSON content type. According to [RFC4627|http://www.ietf.org/rfc/rfc4627.txt] the json content type needs to be application/json (and not text/x-json). The reason this can be very helpful is that today you have plugins for browsers (e.g. [JSONView|http://brh.numbera.com/software/jsonview]) that can render any page with application/json content type in a user friendly manner (just like xml is supported).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (SOLR-1123) Change the JSONResponseWriter content type

Posted by "Uri Boness (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SOLR-1123?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Uri Boness updated SOLR-1123:
-----------------------------

    Attachment: JSON_contentType_incl_tests.patch

This patch is a simple implementation for this functionality. The writer can be configured with a {{userJsonContentType}} boolean parameter that when set to {{true}} the content type for the output will be "application/json" instead of "text/plain". For backward compatibility reasons, when this parameter is absent, the "text/plain" content type will be used.

> Change the JSONResponseWriter content type
> ------------------------------------------
>
>                 Key: SOLR-1123
>                 URL: https://issues.apache.org/jira/browse/SOLR-1123
>             Project: Solr
>          Issue Type: Improvement
>    Affects Versions: 1.3
>            Reporter: Uri Boness
>             Fix For: 1.3.1
>
>         Attachments: JSON_contentType_incl_tests.patch
>
>
> Currently the jSON content type is not used. Instead the palin/text content type is used. The reason for this as I understand is to enable viewing the json response as as text in the browser. While this is valid argument, I do believe that there should at least be an option to configure this writer to use the JSON content type. According to [RFC4627|http://www.ietf.org/rfc/rfc4627.txt] the json content type needs to be application/json (and not text/x-json). The reason this can be very helpful is that today you have plugins for browsers (e.g. [JSONView|http://brh.numbera.com/software/jsonview]) that can render any page with application/json content type in a user friendly manner (just like xml is supported).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SOLR-1123) Change the JSONResponseWriter content type

Posted by "Lance Norskog (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-1123?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12793466#action_12793466 ] 

Lance Norskog commented on SOLR-1123:
-------------------------------------

Thinking about it again, 'wt' selects the writer, so parameters to the JSON writer should be 'wt.param=value'. 'tr' is the transformer script, and 'tr.param=value' should pass data through to the transformer code. So, to handle this problem I would use 'wt=json&wt.mime-type=application/json'.

> Change the JSONResponseWriter content type
> ------------------------------------------
>
>                 Key: SOLR-1123
>                 URL: https://issues.apache.org/jira/browse/SOLR-1123
>             Project: Solr
>          Issue Type: Improvement
>            Reporter: Uri Boness
>             Fix For: 1.5
>
>         Attachments: JSON_contentType_incl_tests.patch
>
>
> Currently the jSON content type is not used. Instead the palin/text content type is used. The reason for this as I understand is to enable viewing the json response as as text in the browser. While this is valid argument, I do believe that there should at least be an option to configure this writer to use the JSON content type. According to [RFC4627|http://www.ietf.org/rfc/rfc4627.txt] the json content type needs to be application/json (and not text/x-json). The reason this can be very helpful is that today you have plugins for browsers (e.g. [JSONView|http://brh.numbera.com/software/jsonview]) that can render any page with application/json content type in a user friendly manner (just like xml is supported).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SOLR-1123) Change the JSONResponseWriter content type

Posted by "Chris A. Mattmann (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-1123?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12789923#action_12789923 ] 

Chris A. Mattmann commented on SOLR-1123:
-----------------------------------------

{quote}
I think the main issue with the inheritance right now is that the QueryResponseWriter interface is dealing with a Writer rather than with an OutputStream. This accounts for the hacky GenericBinaryResponseWriter. 
{quote}

I'm taking a look at this.

{quote}
Looking at SOLR-1516 I'm a bit confused. I always had the impression that the main idea behind the response writers is that all they need to know is how to marshal a NamedList (so they don't need explicit knowledge of documents, highlighting, etc...). But now the GenericTextResponseWriter knows about documents (via the SingleResponseWriter). But perhaps I just go it wrong.
{quote}

Well if that's the main idea behind ResponseWriters as you put it, then as I put it in SOLR-1516, it's pretty confusing. Users (who understand Lucene and SOLR) know that if they query they get back o.a.lucene.Documents or o.a.solr.SolrDocumentList, etc. The whole NamedList structure is pretty confusing to me (and to others as I've noted on other issues and on the mailing list). SOLR-1516 was an attempt to give those people writing ResponseWriters (now) the ability to deal with results of queries, aka Documents (and not all the other NamedList typeless bag of objects where you have to do instanceof everwhere to unmarshall it). Clearly not all ResponseWriters will be able to take advantage of this (e.g., those that need the specified output structures provided by other components, e.g., Facets, etc.), which is why my original patch called the two response writers I added Document*ResponseWriter b/c that's what they dealt with.

Cheers,
Chris


> Change the JSONResponseWriter content type
> ------------------------------------------
>
>                 Key: SOLR-1123
>                 URL: https://issues.apache.org/jira/browse/SOLR-1123
>             Project: Solr
>          Issue Type: Improvement
>            Reporter: Uri Boness
>             Fix For: 1.5
>
>         Attachments: JSON_contentType_incl_tests.patch
>
>
> Currently the jSON content type is not used. Instead the palin/text content type is used. The reason for this as I understand is to enable viewing the json response as as text in the browser. While this is valid argument, I do believe that there should at least be an option to configure this writer to use the JSON content type. According to [RFC4627|http://www.ietf.org/rfc/rfc4627.txt] the json content type needs to be application/json (and not text/x-json). The reason this can be very helpful is that today you have plugins for browsers (e.g. [JSONView|http://brh.numbera.com/software/jsonview]) that can render any page with application/json content type in a user friendly manner (just like xml is supported).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SOLR-1123) Change the JSONResponseWriter content type

Posted by "Uri Boness (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-1123?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12711145#action_12711145 ] 

Uri Boness commented on SOLR-1123:
----------------------------------

Yeah, that's also an option. The only drawbacks like we mentioned above is that you'll need to add yet another request parameter. And I also thought it was a good opportunity to "fix"/"clean" the class hierarchy of the response writer. But indeed this is a quicker fix to the problem.

> Change the JSONResponseWriter content type
> ------------------------------------------
>
>                 Key: SOLR-1123
>                 URL: https://issues.apache.org/jira/browse/SOLR-1123
>             Project: Solr
>          Issue Type: Improvement
>            Reporter: Uri Boness
>             Fix For: 1.5
>
>         Attachments: JSON_contentType_incl_tests.patch
>
>
> Currently the jSON content type is not used. Instead the palin/text content type is used. The reason for this as I understand is to enable viewing the json response as as text in the browser. While this is valid argument, I do believe that there should at least be an option to configure this writer to use the JSON content type. According to [RFC4627|http://www.ietf.org/rfc/rfc4627.txt] the json content type needs to be application/json (and not text/x-json). The reason this can be very helpful is that today you have plugins for browsers (e.g. [JSONView|http://brh.numbera.com/software/jsonview]) that can render any page with application/json content type in a user friendly manner (just like xml is supported).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SOLR-1123) Change the JSONResponseWriter content type

Posted by "Noble Paul (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-1123?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12789998#action_12789998 ] 

Noble Paul commented on SOLR-1123:
----------------------------------

bq. I always had the impression that the main idea behind the response writers is that all they need to know is how to marshal a NamedList ...

That is the problem. the NamedList is a weird datastructure for those who are not so used to Solr. You don't know what is included in that unless you do an instanceof. Most of the users are happy to write out the documents . understanding a SolrDocument is far easier than figuring outhow to handle a DocList .So it is an attempt to cater to those needs .  

If you know how to handle the NamedList beast then you can do that also ( but only if you wish to). 

> Change the JSONResponseWriter content type
> ------------------------------------------
>
>                 Key: SOLR-1123
>                 URL: https://issues.apache.org/jira/browse/SOLR-1123
>             Project: Solr
>          Issue Type: Improvement
>            Reporter: Uri Boness
>             Fix For: 1.5
>
>         Attachments: JSON_contentType_incl_tests.patch
>
>
> Currently the jSON content type is not used. Instead the palin/text content type is used. The reason for this as I understand is to enable viewing the json response as as text in the browser. While this is valid argument, I do believe that there should at least be an option to configure this writer to use the JSON content type. According to [RFC4627|http://www.ietf.org/rfc/rfc4627.txt] the json content type needs to be application/json (and not text/x-json). The reason this can be very helpful is that today you have plugins for browsers (e.g. [JSONView|http://brh.numbera.com/software/jsonview]) that can render any page with application/json content type in a user friendly manner (just like xml is supported).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SOLR-1123) Change the JSONResponseWriter content type

Posted by "Uri Boness (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-1123?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12711075#action_12711075 ] 

Uri Boness commented on SOLR-1123:
----------------------------------

Indeed this is just for convenience and should not be in a high priority, but I definitely see it as a nice to have one. Just to clarify, the suggestion is not to have another request parameter (that would probably be too much as you mentioned) but instead add a configuration parameter in solrconfig. So you'll be able to define the json response writer as follows:

{code:xml}
<queryResponseWriter name="json" class="org.apache.solr.request.JSONResponseWriter">
    <bool name="useJsonContentType">true</bool>
</queryResponseWriter>
{code} 


> Change the JSONResponseWriter content type
> ------------------------------------------
>
>                 Key: SOLR-1123
>                 URL: https://issues.apache.org/jira/browse/SOLR-1123
>             Project: Solr
>          Issue Type: Improvement
>            Reporter: Uri Boness
>             Fix For: 1.5
>
>         Attachments: JSON_contentType_incl_tests.patch
>
>
> Currently the jSON content type is not used. Instead the palin/text content type is used. The reason for this as I understand is to enable viewing the json response as as text in the browser. While this is valid argument, I do believe that there should at least be an option to configure this writer to use the JSON content type. According to [RFC4627|http://www.ietf.org/rfc/rfc4627.txt] the json content type needs to be application/json (and not text/x-json). The reason this can be very helpful is that today you have plugins for browsers (e.g. [JSONView|http://brh.numbera.com/software/jsonview]) that can render any page with application/json content type in a user friendly manner (just like xml is supported).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.