mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-08 14:51:49 +00:00
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:
@@ -275,7 +275,7 @@ public class SolrQueryHTTPClient implements BeanFactoryAware, InitializingBean
|
|||||||
|
|
||||||
Pair<HttpClient, String> httpClientAndBaseUrl = mapping.getHttpClientAndBaseUrl();
|
Pair<HttpClient, String> httpClientAndBaseUrl = mapping.getHttpClientAndBaseUrl();
|
||||||
HttpClient httpClient = httpClientAndBaseUrl.getFirst();
|
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);
|
JSONObject body = buildStatsBody(searchParameters, tenantService.getCurrentUserDomain(), locale);
|
||||||
|
|
||||||
if(httpClient == null)
|
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();
|
URLCodec encoder = new URLCodec();
|
||||||
StringBuilder url = new StringBuilder();
|
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"));
|
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();
|
return url.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -74,7 +74,7 @@ public class SolrQueryHTTPClientTest
|
|||||||
SolrQueryHTTPClient client = new SolrQueryHTTPClient();
|
SolrQueryHTTPClient client = new SolrQueryHTTPClient();
|
||||||
client.setLanguageMappings(languageMappings);
|
client.setLanguageMappings(languageMappings);
|
||||||
StatsParameters params = getParameters();
|
StatsParameters params = getParameters();
|
||||||
String url = client.buildStatsUrl(params, "http://localhost:8080/solr/alfresco/select", Locale.CANADA_FRENCH);
|
String url = client.buildStatsUrl(params, "http://localhost:8080/solr/alfresco/select", Locale.CANADA_FRENCH, null);
|
||||||
assertNotNull(url);
|
assertNotNull(url);
|
||||||
assertTrue(url.contains("locale=fr_CA"));
|
assertTrue(url.contains("locale=fr_CA"));
|
||||||
assertTrue(url.contains("sort=contentsize"));
|
assertTrue(url.contains("sort=contentsize"));
|
||||||
|
Reference in New Issue
Block a user