SOLR-8277: (Search|Top)GroupsFieldCommand tweaks

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1715798 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Christine Poerschke 2015-11-23 13:09:21 +00:00
parent 23dabd19ff
commit 11d8f445be
3 changed files with 8 additions and 6 deletions

View File

@ -557,6 +557,8 @@ Other Changes
* SOLR-8194: Improve error reporting for null documents in UpdateRequest (Markus
Jelsma, Alan Woodward)
* SOLR-8277: (Search|Top)GroupsFieldCommand tweaks (Christine Poerschke)
================== 5.3.1 ==================
Bug Fixes

View File

@ -94,8 +94,8 @@ public class SearchGroupsFieldCommand implements Command<SearchGroupsFieldComman
@Override
public List<Collector> create() throws IOException {
List<Collector> collectors = new ArrayList<>();
FieldType fieldType = field.getType();
final List<Collector> collectors = new ArrayList<>(2);
final FieldType fieldType = field.getType();
if (topNGroups > 0) {
if (fieldType.getNumericType() != null) {
ValueSource vs = fieldType.getValueSource(field, null);
@ -120,7 +120,7 @@ public class SearchGroupsFieldCommand implements Command<SearchGroupsFieldComman
@Override
public SearchGroupsFieldCommandResult result() {
final Collection<SearchGroup<BytesRef>> topGroups;
if (topNGroups > 0) {
if (firstPassGroupingCollector != null) {
if (field.getType().getNumericType() != null) {
topGroups = GroupConverter.fromMutable(field, firstPassGroupingCollector.getTopGroups(0, true));
} else {
@ -130,7 +130,7 @@ public class SearchGroupsFieldCommand implements Command<SearchGroupsFieldComman
topGroups = Collections.emptyList();
}
final Integer groupCount;
if (includeGroupCount) {
if (allGroupsCollector != null) {
groupCount = allGroupsCollector.getGroupCount();
} else {
groupCount = null;

View File

@ -131,8 +131,8 @@ public class TopGroupsFieldCommand implements Command<TopGroups<BytesRef>> {
return Collections.emptyList();
}
List<Collector> collectors = new ArrayList<>();
FieldType fieldType = field.getType();
final List<Collector> collectors = new ArrayList<>(1);
final FieldType fieldType = field.getType();
if (fieldType.getNumericType() != null) {
ValueSource vs = fieldType.getValueSource(field, null);
Collection<SearchGroup<MutableValue>> v = GroupConverter.toMutable(field, firstPhaseGroups);