Merged 5.2.N (5.2.1) to HEAD (5.2)

128737 ahind: Merged 5.1.N (5.1.2) to 5.2.N (5.2.1)
      128736 ahind: Merged 5.1.0 (5.1.0.9) to 5.1.N (5.1.2)
         128469 ahind: MNT-16445: Inconsistent behavior of Site File Type Breakdown dashlet in a sharded environment


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@129277 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2016-08-09 13:40:08 +00:00
parent b62408d099
commit 42eebf9ad8
2 changed files with 25 additions and 3 deletions

View File

@@ -275,7 +275,7 @@ public class SolrQueryHTTPClient implements BeanFactoryAware, InitializingBean
Pair<HttpClient, String> httpClientAndBaseUrl = mapping.getHttpClientAndBaseUrl();
HttpClient httpClient = httpClientAndBaseUrl.getFirst();
String url = buildStatsUrl(searchParameters, httpClientAndBaseUrl.getSecond(), locale);
String url = buildStatsUrl(searchParameters, httpClientAndBaseUrl.getSecond(), locale, mapping);
JSONObject body = buildStatsBody(searchParameters, tenantService.getCurrentUserDomain(), locale);
if(httpClient == null)
@@ -312,7 +312,7 @@ public class SolrQueryHTTPClient implements BeanFactoryAware, InitializingBean
}
}
protected String buildStatsUrl(StatsParameters searchParameters, String baseUrl, Locale locale) throws UnsupportedEncodingException
protected String buildStatsUrl(StatsParameters searchParameters, String baseUrl, Locale locale, SolrStoreMappingWrapper mapping) throws UnsupportedEncodingException
{
URLCodec encoder = new URLCodec();
StringBuilder url = new StringBuilder();
@@ -337,6 +337,28 @@ public class SolrQueryHTTPClient implements BeanFactoryAware, InitializingBean
url.append("&stats.").append(entry.getKey()).append("=").append(encoder.encode(entry.getValue(), "UTF-8"));
}
if((mapping != null) && ((searchParameters.getStores().size() > 1) || (mapping.isSharded())))
{
boolean requiresSeparator = false;
url.append("&shards=");
for(StoreRef storeRef : searchParameters.getStores())
{
SolrStoreMappingWrapper storeMapping = extractMapping(storeRef);
if(requiresSeparator)
{
url.append(',');
}
else
{
requiresSeparator = true;
}
url.append(storeMapping.getShards());
}
}
return url.toString();
}