[
https://issues.apache.org/jira/browse/SOLR-5639?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13875376#comment-13875376
]
Hoss Man commented on SOLR-5639:
--------------------------------
What you are seeing is not "http encoding" or the URL. What you are describing
is a URL that has been "xml escaped" (or html escaped").
if you ask a server for the raw URL {{/foo?a=b&x=y}} the application will
receive the following parameters:
* "a" = "b"
* "amp;x" = "y"
which means if the server is expecting a parameter named "x" it will not get
one -- this is what's happening in your case: you are sending solr a parameter
named "amp;wt" instead of named "wt" and it's being ignored.
You can see this fairly clearly using something like "echoParams" (which is
configured by default in the solr example...
{noformat}
$ curl 'http://localhost:8983/solr/collection1/select?indent=true&wt=json'
<?xml version="1.0" encoding="UTF-8"?>
<response>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">0</int>
<lst name="params">
<str name="indent">true</str>
<str name="amp;wt">json</str>
</lst>
</lst>
<result name="response" numFound="0" start="0">
</result>
</response>
{noformat}
You're going to see the same basic behavior from any server you send a CGI
(aka: form data) request to...
{noformat}
hossman@frisbee:~$ curl -sS
'http://www.tipjar.com/cgi-bin/test?q=bar&wt=json' | grep '<td>json</td>'
<tr><td>amp;wt</td><td>json</td><td>json</td></tr>
hossman@frisbee:~$ curl -sS 'http://www.tipjar.com/cgi-bin/test?q=bar&wt=json'
| grep '<td>json</td>'
<tr><td>wt</td><td>json</td><td>json</td></tr>
{noformat}
bq. This causes severe problem when solr is integrated with GWT client where
embedded script often encode url as per http encoding and ends up failing with
timeout exception. Specially noticeable solr JSONP queries.
I don't really know anything about GWT, but based on your description of the
problem it sounds like something/somewhere in your client code is either
incorrectly XML/HTML escaping the URL prior to being fetched, or it is
correctly XML/HTML escaped for serialization, but then the code you are using
to make the call does not know it is XML/HTML escaped and is then attempting to
use it as a "real" URL.
I suggest that you either: 1) start a thread on solr-user with more detail
about your GWT client code to see if other Solr folks with GWT knowledge can
help spot the problem; 2) ask on a GWT forum about how/why/where URLs used in
JSONP request get escaped and unescaped.
There's really no bug here.
> Return type parameter 'wt' is completely ignored when url is http encoded
> -------------------------------------------------------------------------
>
> Key: SOLR-5639
> URL: https://issues.apache.org/jira/browse/SOLR-5639
> Project: Solr
> Issue Type: Bug
> Components: query parsers, SearchComponents - other
> Affects Versions: 4.5.1
> Environment: Ubuntu 13.04,
> Browser Chrome
> Reporter: Suneeta Mall
>
> Querying solr with 'wt' parameter formats the result type as requested which
> works fine except when url is http encoded.
> For example:
> http://localhost:8983/solr/suggest?q=Status:ac&wt=json&indent=true
> the response I get is :
> <?xml version="1.0" encoding="UTF-8"?>
> <response>
> <lst name="responseHeader">
> <int name="status">0</int>
> <int name="QTime">1</int>
> </lst>
> <lst name="spellcheck">
> <lst name="suggestions">
> <lst name="ac">
> <int name="numFound">5</int>
> <int name="startOffset">7</int>
> <int name="endOffset">9</int>
> <arr name="suggestion">
> <str>acknowledged</str>
> <str>ack</str>
> <str>actual</str>
> <str>actually</str>
> <str>access</str>
> </arr>
> </lst>
> <str name="collation">Status:acknowledged</str>
> </lst>
> </lst>
> </response>
> whereas the correct response should be:
> {
> "responseHeader":{
> "status":0,
> "QTime":1},
> "spellcheck":{
> "suggestions":[
> "ac",{
> "numFound":5,
> "startOffset":7,
> "endOffset":9,
> "suggestion":["acknowledged",
> "ack",
> "actual",
> "actually",
> "access"]},
> "collation","Status:acknowledged"]}}
> This causes severe problem when solr is integrated with GWT client where
> embedded script often encode url as per http encoding and ends up failing
> with timeout exception. Specially noticeable solr JSONP queries. for example:
> http://localhost:8983/solr/suggest?q=Status:ac&wt=json&indent=true&json.wrf=xyz
> when it returns xml instead of json.
> Noticeably other arguments works perfectly fine for example:
> http://localhost:8983/solr/suggest?q=Status:ac&wt=json&indent=true.
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]