Buggy code:
private boolean signalCacheWarning = false ; private TimeLimitingCollector timeLimitingCollector ; public DocList mainResult ; public Grouping ( SolrIndexSearcher searcher , SolrIndexSearcher . QueryResult qr , SolrIndexSearcher . QueryCommand cmd , boolean cacheSecondPassSearch , int maxDocsPercentageToCache , boolean main ) { } public void add ( Grouping . Command groupingCommand ) { } public void addFieldCommand ( String field , SolrQueryRequest request ) throws ParseException { } public void addFunctionCommand ( String groupByStr , SolrQueryRequest request ) throws ParseException { } public void addQueryCommand ( String groupByStr , SolrQueryRequest request ) throws ParseException { } public Grouping setSort ( Sort sort ) { } public Grouping setGroupSort ( Sort groupSort ) { } public Grouping setLimitDefault ( int limitDefault ) { } public Grouping setDocsPerGroupDefault ( int docsPerGroupDefault ) { } public Grouping setGroupOffsetDefault ( int groupOffsetDefault ) { } public Grouping setDefaultFormat ( Grouping . Format defaultFormat ) { } public Grouping setDefaultTotalCount ( Grouping . TotalCount defaultTotalCount ) { } public Grouping setGetGroupedDocSet ( boolean getGroupedDocSet ) { } public List < Grouping . Command > getCommands ( ) { } public void execute ( ) throws IOException { } private void searchWithTimeLimiter ( final Filter luceneFilter , Collector collector ) throws IOException { } int getMax ( int offset , int len , int max ) { } public boolean isSignalCacheWarning ( ) { } public static enum Format { grouped , simple ; } public static enum TotalCount { grouped , ungrouped ; } public abstract class Command < GROUP_VALUE_TYPE > { public String key ; public Sort groupSort ; public Sort sort ; public int docsPerGroup ; public int groupOffset ; public int numGroups ; int actualGroupsToFind ; public int offset ; public Grouping . Format format ; public boolean main ; public Grouping . TotalCount totalCount = Grouping . TotalCount . ungrouped ; TopGroups < GROUP_VALUE_TYPE > result ; protected abstract void prepare ( ) throws IOException { } protected abstract Collector createFirstPassCollector ( ) throws IOException { } protected Collector createSecondPassCollector ( ) throws IOException { } public AbstractAllGroupHeadsCollector < ? > createAllGroupCollector ( ) throws IOException { } protected abstract void finish ( ) throws IOException ; public abstract int getMatches ( ) { } protected Integer getNumberOfGroups ( ) { } protected NamedList commonResponse ( ) { } protected DocList getDocList ( GroupDocs groups ) { } protected void addDocList ( NamedList rsp , GroupDocs groups ) { } protected DocList createSimpleResponse ( ) { } } public class CommandField extends Grouping . Command < BytesRef > { public String groupBy ; TermFirstPassGroupingCollector firstPass ; TermSecondPassGroupingCollector secondPass ; TermAllGroupsCollector allGroupsCollector ; TotalHitCountCollector fallBackCollector ; Collection < SearchGroup < BytesRef > > topGroups ; protected void prepare ( ) throws IOException { } protected Collector createFirstPassCollector ( ) throws IOException { } protected Collector createSecondPassCollector ( ) throws IOException { } @ Override public AbstractAllGroupHeadsCollector < ? > createAllGroupCollector ( ) throws IOException { } protected void finish ( ) throws IOException { result = ( ( secondPass ) != null ) ? secondPass . getTopGroups ( 0 ) : null ; if ( main ) { mainResult = createSimpleResponse ( ) ; return ; } NamedList groupResult = commonResponse ( ) ; if ( ( format ) == ( Grouping . Format . simple ) ) { groupResult . add ( "doclist" , createSimpleResponse ( ) ) ; return ; } List groupList = new ArrayList ( ) ; groupResult . add ( "groups" , groupList ) ; if ( ( result ) == null ) { return ; } if ( ( numGroups ) == 0 ) return ; for ( GroupDocs < BytesRef > group : result . groups ) { NamedList nl = new SimpleOrderedMap ( ) ; groupList . add ( nl ) ; if ( ( group . groupValue ) != null ) { SchemaField schemaField = searcher . getSchema ( ) . getField ( groupBy ) ; FieldType fieldType = schemaField . getType ( ) ; String readableValue = fieldType . indexedToReadable ( group . groupValue . utf8ToString ( ) ) ; <START_BUG> IndexableField field = schemaField . createField ( readableValue , 0.0F ) ; <END_BUG> nl . add ( "groupValue" , fieldType . toObject ( field ) ) ; } else { nl . add ( "groupValue" , null ) ; } addDocList ( nl , group ) ; } } public int getMatches ( ) { } protected Integer getNumberOfGroups ( ) { } } public class CommandQuery extends Grouping . Command { public Query query ; TopDocsCollector topCollector ; FilterCollector collector ; protected void prepare ( ) throws IOException { } protected Collector createFirstPassCollector ( ) throws IOException { } TopDocsCollector newCollector ( Sort sort , boolean needScores ) throws IOException { } protected void finish ( ) throws IOException { TopDocsCollector topDocsCollector = ( ( TopDocsCollector ) ( collector . getDelegate ( ) ) ) ; TopDocs topDocs = topDocsCollector . topDocs ( ) ; GroupDocs < String > groupDocs = new GroupDocs < String > ( Float . NaN , topDocs . getMaxScore ( ) , topDocs . totalHits , topDocs . scoreDocs , query . toString ( ) , null ) ; if ( main ) { mainResult = getDocList ( groupDocs ) ; } else { NamedList rsp = commonResponse ( ) ; addDocList ( rsp , groupDocs ) ; } } public int getMatches ( ) { } } public class CommandFunc extends Grouping . Command < MutableValue > { public ValueSource groupBy ; Map context ; FunctionFirstPassGroupingCollector firstPass ; FunctionSecondPassGroupingCollector secondPass ; TotalHitCountCollector fallBackCollector ; FunctionAllGroupsCollector allGroupsCollector ; Collection < SearchGroup < MutableValue > > topGroups ; protected void prepare ( ) throws IOException { } protected Collector createFirstPassCollector ( ) throws IOException { } protected Collector createSecondPassCollector ( ) throws IOException { } @ Override public AbstractAllGroupHeadsCollector < ? > createAllGroupCollector ( ) throws IOException { }

Fix:
IndexableField field = schemaField . createField ( readableValue , 1.0F ) ;