mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
Merged 5.2.N (5.2.2) to HEAD (5.2)
137058 gjames: Merged searchrep (5.2.1) to 5.2.N (5.2.1) 136805 msuzuki: Search-340, changed range to a collection as it may handle many range facets git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@137573 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -495,9 +495,9 @@ public class ResultMapper
|
||||
List<GenericFacetResponse> ffcs = new ArrayList<>(facetFields.size());
|
||||
if (facetFields != null && !facetFields.isEmpty() && searchQuery.getQuery() != null)
|
||||
{
|
||||
List<GenericBucket> buckets = new ArrayList<>();
|
||||
for (Entry<String, List<Map<String, String>>> facet : facetFields.entrySet())
|
||||
{
|
||||
List<GenericBucket> buckets = new ArrayList<>();
|
||||
facet.getValue().forEach(action -> buckets.add(buildGenericBucketFromRange(facet.getKey(), (Map<String, String>) action)));
|
||||
ffcs.add(new GenericFacetResponse(FACET_TYPE.range, facet.getKey(), buckets));
|
||||
}
|
||||
|
@@ -26,6 +26,24 @@
|
||||
|
||||
package org.alfresco.rest.api.search.impl;
|
||||
|
||||
import static org.alfresco.rest.api.Nodes.PARAM_INCLUDE_ALLOWABLEOPERATIONS;
|
||||
import static org.alfresco.rest.api.Nodes.PARAM_INCLUDE_ASPECTNAMES;
|
||||
import static org.alfresco.rest.api.Nodes.PARAM_INCLUDE_ASSOCIATION;
|
||||
import static org.alfresco.rest.api.Nodes.PARAM_INCLUDE_ISLINK;
|
||||
import static org.alfresco.rest.api.Nodes.PARAM_INCLUDE_PATH;
|
||||
import static org.alfresco.rest.api.Nodes.PARAM_INCLUDE_PROPERTIES;
|
||||
import static org.alfresco.service.cmr.search.SearchService.LANGUAGE_CMIS_ALFRESCO;
|
||||
import static org.alfresco.service.cmr.search.SearchService.LANGUAGE_FTS_ALFRESCO;
|
||||
import static org.alfresco.service.cmr.search.SearchService.LANGUAGE_LUCENE;
|
||||
|
||||
import java.time.ZoneId;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Matcher;
|
||||
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.alfresco.repo.search.impl.lucene.LuceneQueryLanguageSPI;
|
||||
import org.alfresco.rest.api.search.context.SearchRequestContext;
|
||||
@@ -61,24 +79,6 @@ import org.alfresco.service.cmr.search.SearchParameters.SortDefinition;
|
||||
import org.alfresco.service.cmr.search.SearchParameters.SortDefinition.SortType;
|
||||
import org.alfresco.service.cmr.search.StatsRequestParameters;
|
||||
import org.alfresco.util.ParameterCheck;
|
||||
import sun.util.calendar.ZoneInfo;
|
||||
|
||||
import static org.alfresco.rest.api.Nodes.PARAM_INCLUDE_ALLOWABLEOPERATIONS;
|
||||
import static org.alfresco.rest.api.Nodes.PARAM_INCLUDE_ASSOCIATION;
|
||||
import static org.alfresco.rest.api.Nodes.PARAM_INCLUDE_ISLINK;
|
||||
import static org.alfresco.rest.api.Nodes.PARAM_INCLUDE_PATH;
|
||||
import static org.alfresco.rest.api.Nodes.PARAM_INCLUDE_ASPECTNAMES;
|
||||
import static org.alfresco.rest.api.Nodes.PARAM_INCLUDE_PROPERTIES;
|
||||
import static org.alfresco.service.cmr.search.SearchService.*;
|
||||
|
||||
import java.time.ZoneId;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.TimeZone;
|
||||
import java.util.regex.Matcher;
|
||||
|
||||
/**
|
||||
* Maps from a json request and a solr SearchParameters object.
|
||||
@@ -530,16 +530,19 @@ public class SearchMapper
|
||||
* @param sp SearchParameters
|
||||
* @param rangeParams RangeParameters
|
||||
*/
|
||||
public void fromRange(SearchParameters sp, RangeParameters rangeParams)
|
||||
public void fromRange(SearchParameters sp, List<RangeParameters> ranges)
|
||||
{
|
||||
if(rangeParams != null)
|
||||
if(ranges != null && !ranges.isEmpty())
|
||||
{
|
||||
ParameterCheck.mandatory("ranges", rangeParams);
|
||||
ParameterCheck.mandatory("field", rangeParams.getField());
|
||||
ParameterCheck.mandatory("start", rangeParams.getStart());
|
||||
ParameterCheck.mandatory("end", rangeParams.getEnd());
|
||||
ParameterCheck.mandatory("gap", rangeParams.getGap());
|
||||
sp.setRanges(rangeParams);
|
||||
for(RangeParameters rangeParams : ranges)
|
||||
{
|
||||
ParameterCheck.mandatory("ranges", rangeParams);
|
||||
ParameterCheck.mandatory("field", rangeParams.getField());
|
||||
ParameterCheck.mandatory("start", rangeParams.getStart());
|
||||
ParameterCheck.mandatory("end", rangeParams.getEnd());
|
||||
ParameterCheck.mandatory("gap", rangeParams.getGap());
|
||||
}
|
||||
sp.setRanges(ranges);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -61,7 +61,7 @@ public class SearchQuery
|
||||
private final boolean includeRequest;
|
||||
private final List<Pivot> pivots;
|
||||
private final List<StatsRequestParameters> stats;
|
||||
private final RangeParameters ranges;
|
||||
private final List<RangeParameters> ranges;
|
||||
private final String timezone;
|
||||
|
||||
public static final SearchQuery EMPTY = new SearchQuery(null, null, null, null, null, null,
|
||||
@@ -87,7 +87,7 @@ public class SearchQuery
|
||||
@JsonProperty("facetIntervals")IntervalParameters facetIntervals,
|
||||
@JsonProperty("pivots") List<Pivot> pivots,
|
||||
@JsonProperty("stats") List<StatsRequestParameters> stats,
|
||||
@JsonProperty("ranges") RangeParameters ranges,
|
||||
@JsonProperty("ranges") List<RangeParameters> ranges,
|
||||
@JsonProperty("timezone") String timezone)
|
||||
{
|
||||
this.query = query;
|
||||
@@ -201,7 +201,7 @@ public class SearchQuery
|
||||
return stats;
|
||||
}
|
||||
|
||||
public RangeParameters getFacetRanges()
|
||||
public List<RangeParameters> getFacetRanges()
|
||||
{
|
||||
return ranges;
|
||||
}
|
||||
|
Reference in New Issue
Block a user