Mark Peng created SOLR-6658:
-------------------------------
Summary: 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.10.1, 4.10, 4.9.1, 4.9, 4.8.1, 4.8, 4.7.2, 4.7.1, 4.7
Reporter: Mark Peng
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: [email protected]
For additional commands, e-mail: [email protected]