mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-08 14:51:49 +00:00
Merged searchrep (5.2.1) to 5.2.N (5.2.1)
136808 gjames: SEARCH-339: Adding bucketInfo for intervals with consistent names git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@137060 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -96,8 +96,8 @@ public class SolrJSONResultSet implements ResultSet, JSONResult
|
|||||||
|
|
||||||
private Map<NodeRef, List<Pair<String, List<String>>>> highlighting = new HashMap<>();
|
private Map<NodeRef, List<Pair<String, List<String>>>> highlighting = new HashMap<>();
|
||||||
|
|
||||||
private Map<String, List<Pair<String, Integer>>> facetIntervals = new HashMap<String, List<Pair<String, Integer>>>(1);
|
private Map<String, List<Pair<String, Integer>>> facetIntervals = new HashMap<String, List<Pair<String, Integer>>>(1);
|
||||||
|
|
||||||
private Map<String,List<Map<String,String>>> facetRanges = new HashMap<String,List<Map<String,String>>>();
|
private Map<String,List<Map<String,String>>> facetRanges = new HashMap<String,List<Map<String,String>>>();
|
||||||
|
|
||||||
private List<GenericFacetResponse> pivotFacets = new ArrayList<>();
|
private List<GenericFacetResponse> pivotFacets = new ArrayList<>();
|
||||||
@@ -298,32 +298,32 @@ public class SolrJSONResultSet implements ResultSet, JSONResult
|
|||||||
String pivotName = (String)it.next();
|
String pivotName = (String)it.next();
|
||||||
pivotFacets = buildPivot(facet_pivot, pivotName);
|
pivotFacets = buildPivot(facet_pivot, pivotName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(facet_counts.has("facet_ranges"))
|
if(facet_counts.has("facet_ranges"))
|
||||||
{
|
{
|
||||||
JSONObject facet_ranges = facet_counts.getJSONObject("facet_ranges");
|
JSONObject facet_ranges = facet_counts.getJSONObject("facet_ranges");
|
||||||
for(Iterator it = facet_ranges.keys(); it.hasNext();)
|
for(Iterator it = facet_ranges.keys(); it.hasNext();)
|
||||||
{
|
{
|
||||||
String fieldName = (String) it.next();
|
String fieldName = (String) it.next();
|
||||||
String end = facet_ranges.getJSONObject(fieldName).getString("end");
|
String end = facet_ranges.getJSONObject(fieldName).getString("end");
|
||||||
JSONArray rangeCollection = facet_ranges.getJSONObject(fieldName).getJSONArray("counts");
|
JSONArray rangeCollection = facet_ranges.getJSONObject(fieldName).getJSONArray("counts");
|
||||||
List<Map<String, String>> buckets = new ArrayList<Map<String, String>>();
|
List<Map<String, String>> buckets = new ArrayList<Map<String, String>>();
|
||||||
for(int i = 0; i < rangeCollection.length(); i+=2)
|
for(int i = 0; i < rangeCollection.length(); i+=2)
|
||||||
{
|
{
|
||||||
Map<String,String> rangeMap = new HashMap<String,String>(3);
|
Map<String,String> rangeMap = new HashMap<String,String>(3);
|
||||||
String rangeFrom = rangeCollection.getString(i);
|
String rangeFrom = rangeCollection.getString(i);
|
||||||
String facetRangeCount = rangeCollection.getString(i+1);
|
String facetRangeCount = rangeCollection.getString(i+1);
|
||||||
String rangeTo = (i+2 < rangeCollection.length() ? rangeCollection.getString(i+2):end);
|
String rangeTo = (i+2 < rangeCollection.length() ? rangeCollection.getString(i+2):end);
|
||||||
String label = rangeFrom + " - " + rangeTo;
|
String label = rangeFrom + " - " + rangeTo;
|
||||||
rangeMap.put("label", label);
|
rangeMap.put(GenericFacetResponse.LABEL, label);
|
||||||
rangeMap.put("count", facetRangeCount);
|
rangeMap.put(GenericFacetResponse.COUNT, facetRangeCount);
|
||||||
rangeMap.put("from", rangeFrom);
|
rangeMap.put(GenericFacetResponse.START, rangeFrom);
|
||||||
rangeMap.put("to", rangeTo);
|
rangeMap.put(GenericFacetResponse.END, rangeTo);
|
||||||
buckets.add(rangeMap);
|
buckets.add(rangeMap);
|
||||||
}
|
}
|
||||||
facetRanges.put(fieldName, buckets);
|
facetRanges.put(fieldName, buckets);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -722,11 +722,11 @@ public class SolrJSONResultSet implements ResultSet, JSONResult
|
|||||||
public boolean getProcessedDenies()
|
public boolean getProcessedDenies()
|
||||||
{
|
{
|
||||||
return processedDenies;
|
return processedDenies;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String,List<Map<String,String>>> getFacetRanges()
|
public Map<String,List<Map<String,String>>> getFacetRanges()
|
||||||
{
|
{
|
||||||
return facetRanges;
|
return facetRanges;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -58,14 +58,14 @@ public class GenericBucket
|
|||||||
this.facets = facets;
|
this.facets = facets;
|
||||||
|
|
||||||
}
|
}
|
||||||
public GenericBucket(String label, String filterQuery, Object display, Set<Metric> metrics, List<GenericFacetResponse> facets, Map<String, String> facetInfo)
|
public GenericBucket(String label, String filterQuery, Object display, Set<Metric> metrics, List<GenericFacetResponse> facets, Map<String, String> bucketInfo)
|
||||||
{
|
{
|
||||||
this.label = label;
|
this.label = label;
|
||||||
this.filterQuery = filterQuery;
|
this.filterQuery = filterQuery;
|
||||||
this.display = display;
|
this.display = display;
|
||||||
this.metrics = metrics;
|
this.metrics = metrics;
|
||||||
this.facets = facets;
|
this.facets = facets;
|
||||||
this.bucketInfo = facetInfo;
|
this.bucketInfo = bucketInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getFilterQuery()
|
public String getFilterQuery()
|
||||||
|
@@ -37,6 +37,13 @@ public class GenericFacetResponse
|
|||||||
private final String label;
|
private final String label;
|
||||||
private final List<GenericBucket> buckets;
|
private final List<GenericBucket> buckets;
|
||||||
|
|
||||||
|
public static final String LABEL = "label";
|
||||||
|
public static final String COUNT = "count";
|
||||||
|
public static final String START = "start";
|
||||||
|
public static final String END = "end";
|
||||||
|
public static final String START_INC = "startInclusive";
|
||||||
|
public static final String END_INC = "endInclusive";
|
||||||
|
|
||||||
public GenericFacetResponse(FACET_TYPE type, String label, List<GenericBucket> buckets)
|
public GenericFacetResponse(FACET_TYPE type, String label, List<GenericBucket> buckets)
|
||||||
{
|
{
|
||||||
this.type = type;
|
this.type = type;
|
||||||
|
Reference in New Issue
Block a user