diff --git a/solr/core/src/java/org/apache/solr/handler/component/QueryComponent.java b/solr/core/src/java/org/apache/solr/handler/component/QueryComponent.java index 18c305f11fc..d991d2cb64b 100644 --- a/solr/core/src/java/org/apache/solr/handler/component/QueryComponent.java +++ b/solr/core/src/java/org/apache/solr/handler/component/QueryComponent.java @@ -276,7 +276,7 @@ public class QueryComponent extends SearchComponent if (groupingSpec != null) { try { boolean needScores = (cmd.getFlags() & SolrIndexSearcher.GET_SCORES) != 0; - if (params.getBool("group.distributed.first", false)) { + if (params.getBool(GroupParams.GROUP_DISTRIBUTED_FIRST, false)) { CommandHandler.Builder topsGroupsActionBuilder = new CommandHandler.Builder() .setQueryCommand(cmd) .setNeedDocSet(false) // Order matters here @@ -297,14 +297,14 @@ public class QueryComponent extends SearchComponent rsp.add("firstPhase", commandHandler.processResult(result, serializer)); rb.setResult(result); return; - } else if (params.getBool("group.distributed.second", false)) { + } else if (params.getBool(GroupParams.GROUP_DISTRIBUTED_SECOND, false)) { CommandHandler.Builder secondPhaseBuilder = new CommandHandler.Builder() .setQueryCommand(cmd) .setTruncateGroups(groupingSpec.isTruncateGroups() && groupingSpec.getFields().length > 0) .setSearcher(searcher); for (String field : groupingSpec.getFields()) { - String[] topGroupsParam = params.getParams("group.topgroups." + field); + String[] topGroupsParam = params.getParams(GroupParams.GROUP_DISTRIBUTED_TOPGROUPS_PREFIX + field); if (topGroupsParam == null) { continue; } diff --git a/solr/core/src/java/org/apache/solr/search/grouping/distributed/requestfactory/SearchGroupsRequestFactory.java b/solr/core/src/java/org/apache/solr/search/grouping/distributed/requestfactory/SearchGroupsRequestFactory.java index acf981ea059..1186c5e9f21 100644 --- a/solr/core/src/java/org/apache/solr/search/grouping/distributed/requestfactory/SearchGroupsRequestFactory.java +++ b/solr/core/src/java/org/apache/solr/search/grouping/distributed/requestfactory/SearchGroupsRequestFactory.java @@ -18,6 +18,7 @@ package org.apache.solr.search.grouping.distributed.requestfactory; */ import org.apache.solr.common.params.CommonParams; +import org.apache.solr.common.params.GroupParams; import org.apache.solr.common.params.ModifiableSolrParams; import org.apache.solr.common.params.ShardParams; import org.apache.solr.handler.component.ResponseBuilder; @@ -71,7 +72,7 @@ public class SearchGroupsRequestFactory implements ShardRequestFactory { // in this first phase, request only the unique key field // and any fields needed for merging. - sreq.params.set("group.distributed.first","true"); + sreq.params.set(GroupParams.GROUP_DISTRIBUTED_FIRST, "true"); if ( (rb.getFieldFlags() & SolrIndexSearcher.GET_SCORES)!=0 || rb.getSortSpec().includesScore()) { sreq.params.set(CommonParams.FL, rb.req.getSchema().getUniqueKeyField().getName() + ",score"); diff --git a/solr/core/src/java/org/apache/solr/search/grouping/distributed/requestfactory/TopGroupsShardRequestFactory.java b/solr/core/src/java/org/apache/solr/search/grouping/distributed/requestfactory/TopGroupsShardRequestFactory.java index 989aa2b03eb..5b0d5ab2e86 100644 --- a/solr/core/src/java/org/apache/solr/search/grouping/distributed/requestfactory/TopGroupsShardRequestFactory.java +++ b/solr/core/src/java/org/apache/solr/search/grouping/distributed/requestfactory/TopGroupsShardRequestFactory.java @@ -110,7 +110,7 @@ public class TopGroupsShardRequestFactory implements ShardRequestFactory { sreq.params.set(CommonParams.ROWS, rb.getSortSpec().getOffset() + rb.getSortSpec().getCount()); } - sreq.params.set("group.distributed.second", "true"); + sreq.params.set(GroupParams.GROUP_DISTRIBUTED_SECOND, "true"); for (Map.Entry>> entry : rb.mergedSearchGroups.entrySet()) { for (SearchGroup searchGroup : entry.getValue()) { String groupValue; @@ -121,7 +121,7 @@ public class TopGroupsShardRequestFactory implements ShardRequestFactory { } else { groupValue = GROUP_NULL_VALUE; } - sreq.params.add("group.topgroups." + entry.getKey(), groupValue); + sreq.params.add(GroupParams.GROUP_DISTRIBUTED_TOPGROUPS_PREFIX + entry.getKey(), groupValue); } } diff --git a/solr/solrj/src/java/org/apache/solr/common/params/GroupParams.java b/solr/solrj/src/java/org/apache/solr/common/params/GroupParams.java index 919b35b9231..fd480873a41 100755 --- a/solr/solrj/src/java/org/apache/solr/common/params/GroupParams.java +++ b/solr/solrj/src/java/org/apache/solr/common/params/GroupParams.java @@ -57,5 +57,15 @@ public interface GroupParams { /** Whether to compute grouped facets based on the first specified group. */ public static final String GROUP_FACET = GROUP + ".facet"; + + /** Retrieve the top search groups (top group values) from the shards being queried. */ + public static final String GROUP_DISTRIBUTED_FIRST = GROUP + ".distributed.first"; + + /** Retrieve the top groups from the shards being queries based on the specified search groups in + * the {@link #GROUP_DISTRIBUTED_TOPGROUPS_PREFIX} parameters. + */ + public static final String GROUP_DISTRIBUTED_SECOND = GROUP + ".distributed.second"; + + public static final String GROUP_DISTRIBUTED_TOPGROUPS_PREFIX = GROUP + ".topgroups."; }