[ 
https://issues.apache.org/jira/browse/SOLR-6658?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14222770#comment-14222770
 ] 

Evan Liu commented on SOLR-6658:
--------------------------------

Mikhail Khludnev Thank you very much! But do you mean to customize a 
SearchHandler? I've try that but found but is there another way to solve this? 
It's more complicate than just remove this constraint, considering future 
upgrading and implementing a same "SearchHandler" class. Again appreciate your 
reply.

> SearchHandler should accept POST requests with JSON data in content stream 
> for customized plug-in components
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: SOLR-6658
>                 URL: https://issues.apache.org/jira/browse/SOLR-6658
>             Project: Solr
>          Issue Type: Improvement
>          Components: search, SearchComponents - other
>    Affects Versions: 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1, 4.9, 4.9.1, 4.10, 4.10.1
>            Reporter: Mark Peng
>         Attachments: SOLR-6658.patch
>
>
> This issue relates to the following one:
> *Return HTTP error on POST requests with no Content-Type*
> [https://issues.apache.org/jira/browse/SOLR-5517]
> The original consideration of the above is to make sure that incoming POST 
> requests to SearchHandler have corresponding content-type specified. That is 
> quite reasonable, however, the following lines in the patch cause to reject 
> all POST requests with content stream data, which is not necessary to that 
> issue:
> {code}
> Index: solr/core/src/java/org/apache/solr/handler/component/SearchHandler.java
> ===================================================================
> --- solr/core/src/java/org/apache/solr/handler/component/SearchHandler.java   
> (revision 1546817)
> +++ solr/core/src/java/org/apache/solr/handler/component/SearchHandler.java   
> (working copy)
> @@ -22,9 +22,11 @@
>  import java.util.List;
>  
>  import org.apache.solr.common.SolrException;
> +import org.apache.solr.common.SolrException.ErrorCode;
>  import org.apache.solr.common.params.CommonParams;
>  import org.apache.solr.common.params.ModifiableSolrParams;
>  import org.apache.solr.common.params.ShardParams;
> +import org.apache.solr.common.util.ContentStream;
>  import org.apache.solr.core.CloseHook;
>  import org.apache.solr.core.PluginInfo;
>  import org.apache.solr.core.SolrCore;
> @@ -165,6 +167,10 @@
>    {
>      // int sleep = req.getParams().getInt("sleep",0);
>      // if (sleep > 0) {log.error("SLEEPING for " + sleep);  
> Thread.sleep(sleep);}
> +    if (req.getContentStreams() != null && 
> req.getContentStreams().iterator().hasNext()) {
> +      throw new SolrException(ErrorCode.BAD_REQUEST, "Search requests cannot 
> accept content streams");
> +    }
> +    
>      ResponseBuilder rb = new ResponseBuilder(req, rsp, components);
>      if (rb.requestInfo != null) {
>        rb.requestInfo.setResponseBuilder(rb);
> {code}
> We are using Solr 4.5.1 in our production services and considering to upgrade 
> to 4.9/5.0 to support more features. But due to this issue, we cannot have a 
> chance to upgrade because we have some important customized SearchComponent 
> plug-ins that need to get POST data from SearchHandler to do further 
> processing.
> Therefore, we are requesting if it is possible to remove the content stream 
> constraint shown above and to let SearchHandler accept POST requests with 
> *Content-Type: application/json* to allow further components to get the data.
> Thank you.
> Best regards,
> Mark Peng



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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

Reply via email to