diff --git a/pysolr.py b/pysolr.py index 9dc84447..1a22509d 100644 --- a/pysolr.py +++ b/pysolr.py @@ -484,11 +484,11 @@ def _select(self, params, handler=None): if len(params_encoded) < 1024: # Typical case. - path = "%s/?%s" % (handler, params_encoded) + path = "%s?%s" % (handler, params_encoded) return self._send_request("get", path) else: # Handles very long queries by submitting as a POST. - path = "%s/" % handler + path = "%s" % handler headers = { "Content-type": "application/x-www-form-urlencoded; charset=utf-8" } @@ -534,7 +534,7 @@ def _update( path_handler = "select" query_vars.append("qt=%s" % safe_urlencode(handler, True)) - path = "%s/" % path_handler + path = "%s" % path_handler if commit is None: commit = self.always_commit @@ -1261,11 +1261,11 @@ def ping(self, handler="admin/ping", **kwargs): if len(params_encoded) < 1024: # Typical case. - path = "%s/?%s" % (handler, params_encoded) + path = "%s?%s" % (handler, params_encoded) return self._send_request("get", path) else: # Handles very long queries by submitting as a POST. - path = "%s/" % handler + path = "%s" % handler headers = { "Content-type": "application/x-www-form-urlencoded; charset=utf-8" } diff --git a/tests/test_client.py b/tests/test_client.py index 36022e87..e0021d9c 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -566,7 +566,7 @@ def test_search(self): self.assertEqual(len(results), 3) # search should default to 'select' handler args, kwargs = self.solr._send_request.call_args - self.assertTrue(args[1].startswith("select/?")) + self.assertTrue(args[1].startswith("select?")) results = self.solr.search("example") self.assertEqual(len(results), 2) @@ -627,7 +627,7 @@ def test_more_like_this(self): self.assertEqual(len(results), 0) # more_like_this should default to 'mlt' handler args, kwargs = self.solr._send_request.call_args - self.assertTrue(args[1].startswith("mlt/?")) + self.assertTrue(args[1].startswith("mlt?")) # more_like_this should support custom handlers with self.assertRaises(SolrError): @@ -655,7 +655,7 @@ def test_suggest_terms(self): ) # suggest_terms should default to 'mlt' handler args, kwargs = self.solr._send_request.call_args - self.assertTrue(args[1].startswith("terms/?")) + self.assertTrue(args[1].startswith("terms?")) # suggest_terms should support custom handlers with self.assertRaises(SolrError): @@ -732,7 +732,7 @@ def test_add(self): ) # add should default to 'update' handler args, kwargs = self.solr._send_request.call_args - self.assertTrue(args[1].startswith("update/?")) + self.assertTrue(args[1].startswith("update?")) self.assertEqual(len(self.solr.search("doc")), 5) self.assertEqual(len(self.solr.search("example")), 3) @@ -848,7 +848,7 @@ def test_delete(self): self.solr.delete(id="doc_1", commit=True) # delete should default to 'update' handler args, kwargs = self.solr._send_request.call_args - self.assertTrue(args[1].startswith("update/?")) + self.assertTrue(args[1].startswith("update?")) self.assertEqual(len(self.solr.search("doc")), 2) self.assertEqual(len(self.solr.search("type_s:parent")), 2) @@ -915,7 +915,7 @@ def test_commit(self): self.solr.commit() # commit should default to 'update' handler args, kwargs = self.solr._send_request.call_args - self.assertTrue(args[1].startswith("update/?")) + self.assertTrue(args[1].startswith("update?")) self.assertEqual(len(self.solr.search("doc")), 4) def test_can_handles_default_commit_policy(self): @@ -954,7 +954,7 @@ def test_optimize(self): self.solr.optimize() # optimize should default to 'update' handler args, kwargs = self.solr._send_request.call_args - self.assertTrue(args[1].startswith("update/?")) + self.assertTrue(args[1].startswith("update?")) self.assertEqual(len(self.solr.search("doc")), 4) # optimize should support custom handlers