SOLR-3052: Added jdocs

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1303206 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Martijn van Groningen 2012-03-20 23:26:19 +00:00
parent c20242721f
commit a25cb028e1
4 changed files with 17 additions and 6 deletions

View File

@ -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;
}

View File

@ -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");

View File

@ -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<String, Collection<SearchGroup<BytesRef>>> entry : rb.mergedSearchGroups.entrySet()) {
for (SearchGroup<BytesRef> 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);
}
}

View File

@ -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.";
}