From a25cb028e1435b84ee37800820a9a0679c4bac99 Mon Sep 17 00:00:00 2001 From: Martijn van Groningen Date: Tue, 20 Mar 2012 23:26:19 +0000 Subject: [PATCH] SOLR-3052: Added jdocs git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1303206 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/solr/handler/component/QueryComponent.java | 6 +++--- .../requestfactory/SearchGroupsRequestFactory.java | 3 ++- .../requestfactory/TopGroupsShardRequestFactory.java | 4 ++-- .../org/apache/solr/common/params/GroupParams.java | 10 ++++++++++ 4 files changed, 17 insertions(+), 6 deletions(-) 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."; }