mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged HEAD-BUG-FIX (5.0/Cloud) to HEAD (5.0/Cloud)
75005: Merged WAT2 (5.0/Cloud) to HEAD-BUG-FIX (5.0/Cloud) 70182: WIP, allows date ranges for solr stats queries git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@75334 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -66,7 +66,7 @@ public class SolrQueryHTTPClientTest
|
||||
luceneQuery.append(" +TYPE:\"" + ContentModel.TYPE_CONTENT + "\"");
|
||||
|
||||
String filterQuery = "ANCESTOR:\"workspace://SpacesStore/a1c1a0a1-9d68-4912-b853-b3b277f31288\"";
|
||||
StatsParameters params = new StatsParameters(SearchService.LANGUAGE_SOLR_FTS_ALFRESCO, luceneQuery.toString(), filterQuery);
|
||||
StatsParameters params = new StatsParameters(SearchService.LANGUAGE_SOLR_FTS_ALFRESCO, luceneQuery.toString(), filterQuery, false);
|
||||
params.addSort(new SortDefinition(SortDefinition.SortType.FIELD, "contentsize", false));
|
||||
params.addStatsParameter(StatsParameters.PARAM_FIELD, "contentsize");
|
||||
params.addStatsParameter(StatsParameters.PARAM_FACET, StatsParameters.FACET_PREFIX+ContentModel.PROP_CREATED.toString());
|
||||
|
@@ -7,6 +7,7 @@ import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import org.json.JSONTokener;
|
||||
import org.junit.Test;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
public class SolrStatsResultTest
|
||||
{
|
||||
@@ -26,10 +27,22 @@ public class SolrStatsResultTest
|
||||
SolrStatsResult resultMod = testProcessing(TEST_MODIFIER, 9, 4, 188);
|
||||
SolrStatsResult resultV = testProcessing(TEST_VERSIONLABEL_DOT, 6, 0, 190);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSolrStatsResultDateFormat() throws JSONException
|
||||
{
|
||||
String date = SolrStatsResult.formatAsDate(null);
|
||||
assertNotNull(date);
|
||||
assertTrue(!StringUtils.hasText(date));
|
||||
|
||||
assertEquals("2011-03-03", SolrStatsResult.formatAsDate("2011-03-03T10:34:53.551Z"));
|
||||
assertEquals("2014-05-12", SolrStatsResult.formatAsDate("2014-05-12T16:26:53.292Z"));
|
||||
}
|
||||
|
||||
private SolrStatsResult testProcessing(String testData, long queryTime, int statsSize, long numberFound) throws JSONException
|
||||
{
|
||||
JSONObject json = new JSONObject(new JSONTokener(testData));
|
||||
SolrStatsResult result = new SolrStatsResult(json);
|
||||
SolrStatsResult result = new SolrStatsResult(json, false);
|
||||
|
||||
assertNotNull(result);
|
||||
assertEquals(numberFound, result.getNumberFound());
|
||||
@@ -39,7 +52,6 @@ public class SolrStatsResultTest
|
||||
assertTrue(result.getMax()==3737049);
|
||||
assertTrue(result.getMean()==82362);
|
||||
assertEquals(statsSize, result.getStats().size());
|
||||
System.out.println(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user