SOLR-8025: remove unnecessary ResponseBuilder.getQueryCommand() calls

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1706313 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Christine Poerschke 2015-10-01 19:56:45 +00:00
parent 3749a573b5
commit b095fdfd9f
3 changed files with 10 additions and 7 deletions

View File

@ -294,6 +294,8 @@ Other Changes
* SOLR-8083: Convert the ZookeeperInfoServlet to a handler at /admin/zookeeper (noble)
* SOLR-8025: remove unnecessary ResponseBuilder.getQueryCommand() calls (Christine Poerschke)
================== 5.3.1 ==================
Bug Fixes

View File

@ -225,7 +225,7 @@ public class QueryComponent extends SearchComponent
}
//Input validation.
if (rb.getQueryCommand().getOffset() < 0) {
if (rb.getSortSpec().getOffset() < 0) {
throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "'start' parameter cannot be negative");
}
}
@ -242,13 +242,14 @@ public class QueryComponent extends SearchComponent
CursorMarkParams.CURSOR_MARK_PARAM);
}
SolrIndexSearcher.QueryCommand cmd = rb.getQueryCommand();
SolrIndexSearcher searcher = rb.req.getSearcher();
GroupingSpecification groupingSpec = new GroupingSpecification();
rb.setGroupingSpec(groupingSpec);
final SortSpec sortSpec = rb.getSortSpec();
//TODO: move weighting of sort
Sort groupSort = searcher.weightSort(cmd.getSort());
Sort groupSort = searcher.weightSort(sortSpec.getSort());
if (groupSort == null) {
groupSort = Sort.RELEVANCE;
}
@ -278,11 +279,11 @@ public class QueryComponent extends SearchComponent
groupingSpec.setFunctions(params.getParams(GroupParams.GROUP_FUNC));
groupingSpec.setGroupOffset(params.getInt(GroupParams.GROUP_OFFSET, 0));
groupingSpec.setGroupLimit(params.getInt(GroupParams.GROUP_LIMIT, 1));
groupingSpec.setOffset(rb.getSortSpec().getOffset());
groupingSpec.setLimit(rb.getSortSpec().getCount());
groupingSpec.setOffset(sortSpec.getOffset());
groupingSpec.setLimit(sortSpec.getCount());
groupingSpec.setIncludeGroupCount(params.getBool(GroupParams.GROUP_TOTAL_COUNT, false));
groupingSpec.setMain(params.getBool(GroupParams.GROUP_MAIN, false));
groupingSpec.setNeedScore((cmd.getFlags() & SolrIndexSearcher.GET_SCORES) != 0);
groupingSpec.setNeedScore((rb.getFieldFlags() & SolrIndexSearcher.GET_SCORES) != 0);
groupingSpec.setTruncateGroups(params.getBool(GroupParams.GROUP_TRUNCATE, false));
}

View File

@ -56,7 +56,7 @@ public class TopGroupsShardRequestFactory implements ShardRequestFactory {
// If we have a group.query we need to query all shards... Or we move this to the group first phase queries
boolean containsGroupByQuery = rb.getGroupingSpec().getQueries().length > 0;
// TODO: If groups.truncate=true we only have to query the specific shards even faceting and statistics are enabled
if ((rb.getQueryCommand().getFlags() & SolrIndexSearcher.GET_DOCSET) != 0 || containsGroupByQuery) {
if (rb.isNeedDocSet() || containsGroupByQuery) {
// In case we need more results such as faceting and statistics we have to query all shards
return createRequestForAllShards(rb);
} else {