You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Shai Erera <se...@gmail.com> on 2013/07/02 13:33:32 UTC

Solr Content-Type for JSON

Hi

I noticed that if I set wt=json, I get back response with
content-type=plain/text instead of application/json. I do see in
JsonResponseWriter that the content type is set correctly, since 3.5.

Any ideas why am I getting back the wrong header? I use 4.3.1 and followed
the simple tutorial, indexed the example docs and changed the 'wt'
parameter:
http://localhost:8983/solr/select/?q=video&fl=id,name,price&wt=json

Copy-paste from Firebug:

Response Headers
Content-Type   text/plain;charset=UTF-8Transfer-Encoding  chunked
Shai

Re: Solr Content-Type for JSON

Posted by Shai Erera <se...@gmail.com>.
I see. We should nuke those browsers from the supported list :).

Shai


On Tue, Jul 2, 2013 at 3:42 PM, Yonik Seeley <yo...@lucidworks.com> wrote:

> On Tue, Jul 2, 2013 at 8:37 AM, Shai Erera <se...@gmail.com> wrote:
>
>> Are there even browsers that won't display the response if wt=json and
>> content-type=application/json?
>> Not talking about pretty-printing the JSON, will browsers fail to display
>> at all?
>>
>
> Yes, they unfortunately fail to display at all last I checked - they
> prompt for you to select a program that can handle the content type, etc...
>  hence the current default.
>
> -Yonik
> http://lucidworks.com
>
>

Re: Solr Content-Type for JSON

Posted by Yonik Seeley <yo...@lucidworks.com>.
On Tue, Jul 2, 2013 at 8:37 AM, Shai Erera <se...@gmail.com> wrote:

> Are there even browsers that won't display the response if wt=json and
> content-type=application/json?
> Not talking about pretty-printing the JSON, will browsers fail to display
> at all?
>

Yes, they unfortunately fail to display at all last I checked - they prompt
for you to select a program that can handle the content type, etc...  hence
the current default.

-Yonik
http://lucidworks.com

Re: Solr Content-Type for JSON

Posted by Shai Erera <se...@gmail.com>.
Are there even browsers that won't display the response if wt=json and
content-type=application/json?
Not talking about pretty-printing the JSON, will browsers fail to display
at all?

Shai


On Tue, Jul 2, 2013 at 3:32 PM, Jack Krupansky <ja...@basetechnology.com>wrote:

>   Unfortunately, the various writer types are inconsistent in terms of
> which ones accept the “content-type” override config parameter and which
> have that parameter configured in the example solrconfig.
>
> For example, PHP takes the config parameter, but Python doesn’t – and
> Python always returns content type as plain text
>
> -- Jack Krupansky
>
>  *From:* Shai Erera <se...@gmail.com>
> *Sent:* Tuesday, July 02, 2013 7:56 AM
> *To:* dev@lucene.apache.org
> *Subject:* Re: Solr Content-Type for JSON
>
>  Thanks that worked!
>
> Shai
>
>
> On Tue, Jul 2, 2013 at 2:51 PM, Stefan Matheis <ma...@gmail.com>wrote:
>
>> Shai
>>
>> There's a note about this, in the sample config:
>> http://svn.apache.org/viewvc/lucene/dev/trunk/solr/example/solr/collection1/conf/solrconfig.xml?view=markup#l1742
>>
>> - Stefan
>>
>> On Tuesday, July 2, 2013 at 1:33 PM, Shai Erera wrote:
>>
>>   Hi
>>
>> I noticed that if I set wt=json, I get back response with
>> content-type=plain/text instead of application/json. I do see in
>> JsonResponseWriter that the content type is set correctly, since 3.5.
>>
>> Any ideas why am I getting back the wrong header? I use 4.3.1 and
>> followed the simple tutorial, indexed the example docs and changed the 'wt'
>> parameter:
>> http://localhost:8983/solr/select/?q=video&fl=id,name,price&wt=json
>>
>> Copy-paste from Firebug:
>>
>>  Response Headers
>>   Content-Type   text/plain;charset=UTF-8 Transfer-Encoding   chunked
>> Shai
>>
>>
>>
>
>

Re: Solr Content-Type for JSON

Posted by Jack Krupansky <ja...@basetechnology.com>.
Unfortunately, the various writer types are inconsistent in terms of which ones accept the “content-type” override config parameter and which have that parameter configured in the example solrconfig.

For example, PHP takes the config parameter, but Python doesn’t – and Python always returns content type as plain text

-- Jack Krupansky

From: Shai Erera 
Sent: Tuesday, July 02, 2013 7:56 AM
To: dev@lucene.apache.org 
Subject: Re: Solr Content-Type for JSON

Thanks that worked!


Shai




On Tue, Jul 2, 2013 at 2:51 PM, Stefan Matheis <ma...@gmail.com> wrote:

  Shai 

  There's a note about this, in the sample config: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/example/solr/collection1/conf/solrconfig.xml?view=markup#l1742

  - Stefan
  On Tuesday, July 2, 2013 at 1:33 PM, Shai Erera wrote:

    Hi

    I noticed that if I set wt=json, I get back response with content-type=plain/text instead of application/json. I do see in JsonResponseWriter that the content type is set correctly, since 3.5.


    Any ideas why am I getting back the wrong header? I use 4.3.1 and followed the simple tutorial, indexed the example docs and changed the 'wt' parameter: http://localhost:8983/solr/select/?q=video&fl=id,name,price&wt=json


    Copy-paste from Firebug:


    Response Headers
          Content-Type   text/plain;charset=UTF-8 
          Transfer-Encoding   chunked 

    Shai



Re: Solr Content-Type for JSON

Posted by Shai Erera <se...@gmail.com>.
Thanks that worked!

Shai


On Tue, Jul 2, 2013 at 2:51 PM, Stefan Matheis <ma...@gmail.com>wrote:

> Shai
>
> There's a note about this, in the sample config:
> http://svn.apache.org/viewvc/lucene/dev/trunk/solr/example/solr/collection1/conf/solrconfig.xml?view=markup#l1742
>
> - Stefan
>
> On Tuesday, July 2, 2013 at 1:33 PM, Shai Erera wrote:
>
> Hi
>
> I noticed that if I set wt=json, I get back response with
> content-type=plain/text instead of application/json. I do see in
> JsonResponseWriter that the content type is set correctly, since 3.5.
>
> Any ideas why am I getting back the wrong header? I use 4.3.1 and followed
> the simple tutorial, indexed the example docs and changed the 'wt'
> parameter:
> http://localhost:8983/solr/select/?q=video&fl=id,name,price&wt=json
>
> Copy-paste from Firebug:
>
> Response Headers
> Content-Type   text/plain;charset=UTF-8Transfer-Encoding  chunked
> Shai
>
>
>

Re: Solr Content-Type for JSON

Posted by Stefan Matheis <ma...@gmail.com>.
Shai

There's a note about this, in the sample config: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/example/solr/collection1/conf/solrconfig.xml?view=markup#l1742

- Stefan 


On Tuesday, July 2, 2013 at 1:33 PM, Shai Erera wrote:

> Hi
> 
> I noticed that if I set wt=json, I get back response with content-type=plain/text instead of application/json. I do see in JsonResponseWriter that the content type is set correctly, since 3.5.
> 
> Any ideas why am I getting back the wrong header? I use 4.3.1 and followed the simple tutorial, indexed the example docs and changed the 'wt' parameter: http://localhost:8983/solr/select/?q=video&fl=id,name,price&wt=json
> 
> Copy-paste from Firebug:
> 
> Response Headers
> Content-Type
>   text/plain;charset=UTF-8
> 
> Transfer-Encoding
>   chunked
> 
> 
> 
> 
> Shai