You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by gc...@apache.org on 2014/10/09 22:00:33 UTC

svn commit: r1630576 - in /lucene/dev/trunk/solr/solrj/src: java/org/apache/solr/client/solrj/impl/HttpSolrServer.java test/org/apache/solr/client/solrj/impl/BasicHttpSolrServerTest.java

Author: gchanan
Date: Thu Oct  9 20:00:32 2014
New Revision: 1630576

URL: http://svn.apache.org/r1630576
Log:
SOLR-6609: queryParams not respected for single-stream UpdateRequests

Modified:
    lucene/dev/trunk/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrServer.java
    lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/impl/BasicHttpSolrServerTest.java

Modified: lucene/dev/trunk/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrServer.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrServer.java?rev=1630576&r1=1630575&r2=1630576&view=diff
==============================================================================
--- lucene/dev/trunk/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrServer.java (original)
+++ lucene/dev/trunk/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrServer.java Thu Oct  9 20:00:32 2014
@@ -330,12 +330,11 @@ public class HttpSolrServer extends Solr
             boolean isMultipart = ((this.useMultiPartPost && SolrRequest.METHOD.POST == request.getMethod())
               || ( streams != null && streams.size() > 1 )) && !hasNullStreamName;
 
-            // send server list and request list as query string params
-            ModifiableSolrParams queryParams = calculateQueryParams(this.queryParams, wparams);
-            queryParams.add(calculateQueryParams(request.getQueryParams(), wparams));
-
             LinkedList<NameValuePair> postOrPutParams = new LinkedList<>();
             if (streams == null || isMultipart) {
+              // send server list and request list as query string params
+              ModifiableSolrParams queryParams = calculateQueryParams(this.queryParams, wparams);
+              queryParams.add(calculateQueryParams(request.getQueryParams(), wparams));
               String fullQueryUrl = url + ClientUtils.toQueryString( queryParams, false );
               HttpEntityEnclosingRequestBase postOrPut = SolrRequest.METHOD.POST == request.getMethod() ?
                 new HttpPost(fullQueryUrl) : new HttpPut(fullQueryUrl);

Modified: lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/impl/BasicHttpSolrServerTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/impl/BasicHttpSolrServerTest.java?rev=1630576&r1=1630575&r2=1630576&view=diff
==============================================================================
--- lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/impl/BasicHttpSolrServerTest.java (original)
+++ lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/impl/BasicHttpSolrServerTest.java Thu Oct  9 20:00:32 2014
@@ -640,5 +640,21 @@ public class BasicHttpSolrServerTest ext
       server.request(req);
     } catch (Throwable t) {}
     verifyServletState(server, req);
+
+    // test with both request and server query params with single stream
+    DebugServlet.clear();
+    req = new UpdateRequest();
+    req.add(new SolrInputDocument());
+    server.setQueryParams(setOf("serverOnly", "both"));
+    req.setQueryParams(setOf("requestOnly", "both"));
+    setReqParamsOf(req, "serverOnly", "requestOnly", "both", "neither");
+     try {
+      server.request(req);
+    } catch (Throwable t) {}
+    // NOTE: single stream requests send all the params
+    // as part of the query string.  So add "neither" to the request
+    // so it passes the verification step.
+    req.setQueryParams(setOf("requestOnly", "both", "neither"));
+    verifyServletState(server, req);
   }
 }