From 1371dbb72dcebd8c170497aa7cd4e2eccb16deb9 Mon Sep 17 00:00:00 2001 From: Gerik Bonaert Date: Wed, 15 Nov 2017 17:10:23 +0100 Subject: [PATCH] Update client.js On older solr the `select` endpoint is not prefixed by the core name. This fix ensures that the requests without a core name are: `/solr/select` instead of `/solr//select/` --- lib/client.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/client.js b/lib/client.js index 879b63b..abea267 100644 --- a/lib/client.js +++ b/lib/client.js @@ -85,7 +85,7 @@ Client.prototype._requestGet = function(path, query, finalCallback) { params = 'q=*:*'; } requestPrefixUrl = this._makeHostUrl(this.options.protocol, this.options.host, this.options.port); - requestPrefixUrl += '/' + [this.options.rootPath, this.options.core, path].join('/'); + requestPrefixUrl += '/' + [this.options.rootPath, this.options.core, path].filter(function (e) { return e; }).join('/'); requestFullPath = requestPrefixUrl + '?' + params; @@ -141,7 +141,7 @@ Client.prototype._requestPost = function(path, data, urlOptions, finalCallback) } requestPrefixUrl = this._makeHostUrl(this.options.protocol, this.options.host, this.options.port); - requestPrefixUrl += '/' + [this.options.rootPath, this.options.core, path].join('/'); + requestPrefixUrl += '/' + [this.options.rootPath, this.options.core, path].filter(function (e) { return e; }).join('/'); requestFullPath = requestPrefixUrl + '?' + params; @@ -390,4 +390,4 @@ Client.prototype.softCommit = function(finalCallback) { }; -module.exports = Client; \ No newline at end of file +module.exports = Client;