diff --git a/source/java/org/alfresco/repo/search/impl/lucene/SolrJSONResultSet.java b/source/java/org/alfresco/repo/search/impl/lucene/SolrJSONResultSet.java
index ea56cc57c3..7231ae08e4 100644
--- a/source/java/org/alfresco/repo/search/impl/lucene/SolrJSONResultSet.java
+++ b/source/java/org/alfresco/repo/search/impl/lucene/SolrJSONResultSet.java
@@ -1,66 +1,68 @@
-/*
- * #%L
- * Alfresco Repository
- * %%
- * Copyright (C) 2005 - 2016 Alfresco Software Limited
- * %%
- * This file is part of the Alfresco software.
- * If the software was purchased under a paid Alfresco license, the terms of
- * the paid license agreement will prevail. Otherwise, the software is
- * provided under the following open source license terms:
- *
- * Alfresco is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Alfresco is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Alfresco. If not, see .
- * #L%
- */
+/*
+ * #%L
+ * Alfresco Repository
+ * %%
+ * Copyright (C) 2005 - 2016 Alfresco Software Limited
+ * %%
+ * This file is part of the Alfresco software.
+ * If the software was purchased under a paid Alfresco license, the terms of
+ * the paid license agreement will prevail. Otherwise, the software is
+ * provided under the following open source license terms:
+ *
+ * Alfresco is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Alfresco is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Alfresco. If not, see .
+ * #L%
+ */
package org.alfresco.repo.search.impl.lucene;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Set;
-import java.util.stream.Collectors;
-
-import org.alfresco.repo.domain.node.NodeDAO;
-import org.alfresco.repo.search.SimpleResultSetMetaData;
-import org.alfresco.repo.search.impl.solr.facet.facetsresponse.GenericBucket;
-import org.alfresco.repo.search.impl.solr.facet.facetsresponse.GenericFacetResponse;
-import org.alfresco.repo.search.impl.solr.facet.facetsresponse.GenericFacetResponse.FACET_TYPE;
-import org.alfresco.repo.search.impl.solr.facet.facetsresponse.ListMetric;
-import org.alfresco.repo.search.impl.solr.facet.facetsresponse.Metric;
-import org.alfresco.repo.search.impl.solr.facet.facetsresponse.Metric.METRIC_TYPE;
-import org.alfresco.repo.search.impl.solr.facet.facetsresponse.PercentileMetric;
-import org.alfresco.repo.search.impl.solr.facet.facetsresponse.SimpleMetric;
-import org.alfresco.service.cmr.repository.ChildAssociationRef;
-import org.alfresco.service.cmr.repository.NodeRef;
-import org.alfresco.service.cmr.repository.NodeService;
-import org.alfresco.service.cmr.search.LimitBy;
-import org.alfresco.service.cmr.search.PermissionEvaluationMode;
-import org.alfresco.service.cmr.search.ResultSet;
-import org.alfresco.service.cmr.search.ResultSetMetaData;
-import org.alfresco.service.cmr.search.ResultSetRow;
-import org.alfresco.service.cmr.search.SearchParameters;
-import org.alfresco.service.cmr.search.SpellCheckResult;
-import org.alfresco.util.Pair;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.json.JSONArray;
-import org.json.JSONException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import org.alfresco.repo.domain.node.NodeDAO;
+import org.alfresco.repo.search.SimpleResultSetMetaData;
+import org.alfresco.repo.search.impl.solr.facet.facetsresponse.GenericBucket;
+import org.alfresco.repo.search.impl.solr.facet.facetsresponse.GenericFacetResponse;
+import org.alfresco.repo.search.impl.solr.facet.facetsresponse.GenericFacetResponse.FACET_TYPE;
+import org.alfresco.repo.search.impl.solr.facet.facetsresponse.ListMetric;
+import org.alfresco.repo.search.impl.solr.facet.facetsresponse.Metric;
+import org.alfresco.repo.search.impl.solr.facet.facetsresponse.Metric.METRIC_TYPE;
+import org.alfresco.repo.search.impl.solr.facet.facetsresponse.PercentileMetric;
+import org.alfresco.repo.search.impl.solr.facet.facetsresponse.RangeResultMapper;
+import org.alfresco.repo.search.impl.solr.facet.facetsresponse.SimpleMetric;
+import org.alfresco.service.cmr.repository.ChildAssociationRef;
+import org.alfresco.service.cmr.repository.NodeRef;
+import org.alfresco.service.cmr.repository.NodeService;
+import org.alfresco.service.cmr.search.LimitBy;
+import org.alfresco.service.cmr.search.PermissionEvaluationMode;
+import org.alfresco.service.cmr.search.RangeParameters;
+import org.alfresco.service.cmr.search.ResultSet;
+import org.alfresco.service.cmr.search.ResultSetMetaData;
+import org.alfresco.service.cmr.search.ResultSetRow;
+import org.alfresco.service.cmr.search.SearchParameters;
+import org.alfresco.service.cmr.search.SpellCheckResult;
+import org.alfresco.util.Pair;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.json.JSONArray;
+import org.json.JSONException;
import org.json.JSONObject;
/**
@@ -296,34 +298,17 @@ public class SolrJSONResultSet implements ResultSet, JSONResult
for(Iterator it = facet_pivot.keys(); it.hasNext(); /**/)
{
String pivotName = (String)it.next();
- pivotFacets.addAll(buildPivot(facet_pivot, pivotName));
+ pivotFacets.addAll(buildPivot(facet_pivot, pivotName, searchParameters.getRanges()));
}
}
if(facet_counts.has("facet_ranges"))
{
JSONObject facet_ranges = facet_counts.getJSONObject("facet_ranges");
- for(Iterator it = facet_ranges.keys(); it.hasNext();)
- {
- String fieldName = (String) it.next();
- String end = facet_ranges.getJSONObject(fieldName).getString("end");
- JSONArray rangeCollection = facet_ranges.getJSONObject(fieldName).getJSONArray("counts");
- List