diff --git a/README.md b/README.md index 8c23d53..d51825c 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ This patch, remove the parameter locale in Solr6 http requests. The plugin is licensed under the [LGPL v3.0](http://www.gnu.org/licenses/lgpl-3.0.html). **State** -Current patch release is 1.0.0 +Current patch release is 1.1.0 **Compatibility** The current version has been developed using Alfresco 201702 and Alfresco SDK 3.0.1 @@ -23,7 +23,7 @@ Downloading the ready-to-deploy-plugin -------------------------------------- The binary distribution is made of one JAR file to be deployed in Alfresco as a repo module: -* [repo JAR](https://github.com/keensoft/alf-21940-repo/releases/download/201707/patch-alf-21940-repo-1.0.0.jar) +* [repo JAR](https://github.com/keensoft/alf-21940-repo/releases/download/1.1.0/patch-alf-21940-repo-1.1.0.jar) You can install it by copying JAR file to `$ALFRESCO_HOME/modules/platform` and re-starting Alfresco. diff --git a/patch-alf-21940-repo/pom.xml b/patch-alf-21940-repo/pom.xml index edc7ac0..51b9999 100644 --- a/patch-alf-21940-repo/pom.xml +++ b/patch-alf-21940-repo/pom.xml @@ -4,7 +4,7 @@ 4.0.0 es.keensoft patch-alf-21940-repo - 1.0.0 + 1.1.0 patch-alf-21940-repo Platform Jar Module - SDK 3 Platform JAR Module (to be included in the alfresco.war) - SDK 3 jar diff --git a/patch-alf-21940-repo/src/main/java/es/keensoft/repo/search/impl/solr/EnhancedSolrQueryHTTPClient.java b/patch-alf-21940-repo/src/main/java/es/keensoft/repo/search/impl/solr/EnhancedSolrQueryHTTPClient.java index b7d4f07..6989f77 100644 --- a/patch-alf-21940-repo/src/main/java/es/keensoft/repo/search/impl/solr/EnhancedSolrQueryHTTPClient.java +++ b/patch-alf-21940-repo/src/main/java/es/keensoft/repo/search/impl/solr/EnhancedSolrQueryHTTPClient.java @@ -11,9 +11,11 @@ import org.apache.commons.httpclient.URIException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; +// Find results for every locale by using '*' as parameter value public class EnhancedSolrQueryHTTPClient extends SolrQueryHTTPClient { static Log logger = LogFactory.getLog(EnhancedSolrQueryHTTPClient.class); @@ -25,12 +27,19 @@ protected JSONResult postSolrQuery(HttpClient httpClient, String url, JSONObject SolrJsonProcessor jsonProcessor, String spellCheckParams) throws UnsupportedEncodingException, IOException, HttpException, URIException, JSONException { - int posPrev = url.toString().indexOf("&locale="); + // Sanitize URL + int posPrev = url.toString().indexOf("&locale="); int posAfter = url.toString().indexOf("&", posPrev + 1 + LOCALE_PARAM.length()); - url = url.toString().substring(0, posPrev) + url.toString().substring(posAfter); - + url = url.toString().substring(0, posPrev) + "&locale=*" + url.toString().substring(posAfter); logger.debug("Sanitized URL: " + url); + // Sanitize Body + body.remove("locales"); + JSONArray locales = new JSONArray(); + locales.put("*"); + body.put("locales", locales); + logger.debug("Sanitized Body: " + body); + return super.postSolrQuery(httpClient, url, body, jsonProcessor, spellCheckParams); }