Buggy code:
public class QueryComponent extends SearchComponent { public static final String COMPONENT_NAME = "query" ; @ Override public void prepare ( ResponseBuilder rb ) throws IOException { } @ Override public void process ( ResponseBuilder rb ) throws IOException { } protected void doFieldSortValues ( ResponseBuilder rb , SolrIndexSearcher searcher ) throws IOException { } protected void doPrefetch ( ResponseBuilder rb ) throws IOException { } @ Override public int distributedProcess ( ResponseBuilder rb ) throws IOException { } private int groupedDistributedProcess ( ResponseBuilder rb ) { } private int regularDistributedProcess ( ResponseBuilder rb ) { } @ Override public void handleResponses ( ResponseBuilder rb , ShardRequest sreq ) { } private void handleGroupedResponses ( ResponseBuilder rb , ShardRequest sreq ) { } private void handleRegularResponses ( ResponseBuilder rb , ShardRequest sreq ) { } @ Override public void finishStage ( ResponseBuilder rb ) { } private static final EndResultTransformer MAIN_END_RESULT_TRANSFORMER = new MainEndResultTransformer ( ) ; private static final EndResultTransformer SIMPLE_END_RESULT_TRANSFORMER = new SimpleEndResultTransformer ( ) ; @ SuppressWarnings ( "unchecked" ) private void groupedFinishStage ( final ResponseBuilder rb ) { GroupingSpecification groupSpec = rb . getGroupingSpec ( ) ; if ( rb . mergedTopGroups . isEmpty ( ) ) { for ( String field : groupSpec . getFields ( ) ) { <START_BUG> rb . mergedTopGroups . put ( field , new org . apache . lucene . search . grouping . TopGroups ( null , null , 0 , 0 , new GroupDocs [ ] { } ) ) ; <END_BUG> } rb . resultIds = new HashMap < Object , ShardDoc > ( ) ; } EndResultTransformer . SolrDocumentSource solrDocumentSource = new EndResultTransformer . SolrDocumentSource ( ) { public SolrDocument retrieve ( ScoreDoc doc ) { ShardDoc solrDoc = ( ( ShardDoc ) ( doc ) ) ; return rb . retrievedDocuments . get ( solrDoc . id ) ; } } ; EndResultTransformer endResultTransformer ; if ( groupSpec . isMain ( ) ) { endResultTransformer = QueryComponent . MAIN_END_RESULT_TRANSFORMER ; } else if ( ( Format . grouped ) == ( groupSpec . getResponseFormat ( ) ) ) { endResultTransformer = new org . apache . solr . search . grouping . endresulttransformer . GroupedEndResultTransformer ( rb . req . getSearcher ( ) ) ; } else if ( ( ( Format . simple ) == ( groupSpec . getResponseFormat ( ) ) ) && ( ! ( groupSpec . isMain ( ) ) ) ) { endResultTransformer = QueryComponent . SIMPLE_END_RESULT_TRANSFORMER ; } else { return ; } Map < String , Object > combinedMap = new LinkedHashMap < String , Object > ( ) ; combinedMap . putAll ( rb . mergedTopGroups ) ; combinedMap . putAll ( rb . mergedQueryCommandResults ) ; endResultTransformer . transform ( combinedMap , rb , solrDocumentSource ) ; } private void regularFinishStage ( ResponseBuilder rb ) { } private void createDistributedIdf ( ResponseBuilder rb ) { } private void createMainQuery ( ResponseBuilder rb ) { } private void mergeIds ( ResponseBuilder rb , ShardRequest sreq ) { } private void createRetrieveDocs ( ResponseBuilder rb ) { } private void returnFields ( ResponseBuilder rb , ShardRequest sreq ) { } @ Override public String getDescription ( ) { } @ Override public String getSource ( ) { } @ Override public URL [ ] getDocs ( ) { } }

Fix:
rb . mergedTopGroups . put ( field , new org . apache . lucene . search . grouping . TopGroups ( null , null , 0 , 0 , new GroupDocs [ ] { } , Float . NaN ) ) ;