You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Johannes Bauer <jo...@mgm-tp.com> on 2016/04/22 16:52:15 UTC

EmbeddedSolrServer should set httpMethod on SolrQueryRequest before handling it.

In EmbeddedSolrServer.request(), a SolrQueryRequest (`req') is created 
and some of the information from the SolrRequest passed in as a 
parameter named `request' are copied from request to req, before req is 
passed as a parameter to core.execute().

One thing that is not copied from the SolrRequest to the 
SolrQueryRequest is the http method (POST/GET).  This leads to some 
requests being handled differently by the remote and the embedded 
server.  In particular, SchemaRequests simply return a JSON description 
of the schema instead of modifying it because they are treated as GET 
requests rather than POST requests by SchemaHandler.handleRequestBody().

Adding a single line:
  req.getContext().put("httpMethod", request.getMethod().name());

in EmbeddedSolrServer.request() fixes the problem for me.

I would have created a JIRA issue but it seems I can't create issues for 
the Solr project in the ASF JIRA: Solr simply doesn't appear in the list 
of projects on the issue creation dialog.

I'm not attaching a patch as the solution is trivial and I'm not sure 
this mailing list allows attachments.

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


Re: EmbeddedSolrServer should set httpMethod on SolrQueryRequest before handling it.

Posted by Nicolas Gavalda <ni...@ametys.org>.
I just reported this issue a week ago, and included a patch (with the 
exact line you're providing, except your ".name()" is probably better 
than my ".toString()" ) : https://issues.apache.org/jira/browse/SOLR-8994.
Feel free to comment/vote on it when the JIRA lockdown is over!

Le 22/04/2016 16:52, Johannes Bauer a écrit :
> In EmbeddedSolrServer.request(), a SolrQueryRequest (`req') is created 
> and some of the information from the SolrRequest passed in as a 
> parameter named `request' are copied from request to req, before req 
> is passed as a parameter to core.execute().
>
> One thing that is not copied from the SolrRequest to the 
> SolrQueryRequest is the http method (POST/GET).  This leads to some 
> requests being handled differently by the remote and the embedded 
> server.  In particular, SchemaRequests simply return a JSON 
> description of the schema instead of modifying it because they are 
> treated as GET requests rather than POST requests by 
> SchemaHandler.handleRequestBody().
>
> Adding a single line:
>  req.getContext().put("httpMethod", request.getMethod().name());
>
> in EmbeddedSolrServer.request() fixes the problem for me.
>
> I would have created a JIRA issue but it seems I can't create issues 
> for the Solr project in the ASF JIRA: Solr simply doesn't appear in 
> the list of projects on the issue creation dialog.
>
> I'm not attaching a patch as the solution is trivial and I'm not sure 
> this mailing list allows attachments.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: dev-help@lucene.apache.org
>


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