Buggy code:
public class CarrotClusteringEngine extends SearchClusteringEngine { private static transient Logger log = LoggerFactory . getLogger ( CarrotClusteringEngine . class ) ; private static final String CARROT_RESOURCES_PREFIX = "clustering//carrot2" ; private static final String SOLR_DOCUMENT_ID = "solrId" ; private String idFieldName ; private Controller controller = ControllerFactory . createPooling ( ) ; private Class < ? extends IClusteringAlgorithm > clusteringAlgorithmClass ; @ Override @ Deprecated public Object cluster ( Query query , DocList docList , SolrQueryRequest sreq ) { } @ Override public Object cluster ( Query query , SolrDocumentList solrDocList , Map < SolrDocument , Integer > docIds , SolrQueryRequest sreq ) { } @ Override @ SuppressWarnings ( { "unchecked" , "rawtypes" } ) public String init ( NamedList config , final SolrCore core ) { } @ Override protected Set < String > getFieldsToLoad ( SolrQueryRequest sreq ) { } private Set < String > getFieldsForClustering ( SolrQueryRequest sreq ) { } @ SuppressWarnings ( "deprecation" ) private List < Document > getDocuments ( SolrDocumentList solrDocList , Map < SolrDocument , Integer > docIds , Query query , final SolrQueryRequest sreq ) throws IOException { SolrHighlighter highlighter = null ; SolrParams solrParams = sreq . getParams ( ) ; SolrCore core = sreq . getCore ( ) ; String urlField = solrParams . get ( URL_FIELD_NAME , "url" ) ; String titleField = solrParams . get ( TITLE_FIELD_NAME , "title" ) ; String snippetField = solrParams . get ( SNIPPET_FIELD_NAME , titleField ) ; boolean produceSummary = solrParams . getBool ( PRODUCE_SUMMARY , false ) ; SolrQueryRequest req = null ; String [ ] snippetFieldAry = null ; <START_BUG> if ( produceSummary == true ) { <END_BUG> highlighter = core . getHighlighter ( ) ; if ( highlighter != null ) { Map < String , Object > args = Maps . newHashMap ( ) ; snippetFieldAry = new String [ ] { snippetField } ; args . put ( FIELDS , snippetFieldAry ) ; args . put ( HIGHLIGHT , "true" ) ; args . put ( SIMPLE_PRE , "" ) ; args . put ( SIMPLE_POST , "" ) ; args . put ( FRAGSIZE , solrParams . getInt ( SUMMARY_FRAGSIZE , solrParams . getInt ( FRAGSIZE , 100 ) ) ) ; req = new LocalSolrQueryRequest ( core , query . toString ( ) , "" , 0 , 1 , args ) { @ Override public SolrIndexSearcher getSearcher ( ) { return sreq . getSearcher ( ) ; } } ; } else { CarrotClusteringEngine . log . warn ( "No<seq2seq4repair_space>highlighter<seq2seq4repair_space>configured,<seq2seq4repair_space>cannot<seq2seq4repair_space>produce<seq2seq4repair_space>summary" ) ; produceSummary = false ; } } Iterator < SolrDocument > docsIter = solrDocList . iterator ( ) ; List < Document > result = new ArrayList < Document > ( solrDocList . size ( ) ) ; float [ ] scores = new float [ ] { 1.0F } ; int [ ] docsHolder = new int [ 1 ] ; Query theQuery = query ; while ( docsIter . hasNext ( ) ) { SolrDocument sdoc = docsIter . next ( ) ; String snippet = getValue ( sdoc , snippetField ) ; if ( produceSummary && ( docIds != null ) ) { docsHolder [ 0 ] = docIds . get ( sdoc ) . intValue ( ) ; DocList docAsList = new DocSlice ( 0 , 1 , docsHolder , scores , 1 , 1.0F ) ; NamedList < Object > highlights = highlighter . doHighlighting ( docAsList , theQuery , req , snippetFieldAry ) ; if ( ( highlights != null ) && ( ( highlights . size ( ) ) == 1 ) ) { @ SuppressWarnings ( "unchecked" ) NamedList < String [ ] > tmp = ( ( NamedList < String [ ] > ) ( highlights . getVal ( 0 ) ) ) ; String [ ] highlt = tmp . get ( snippetField ) ; if ( ( highlt != null ) && ( ( highlt . length ) == 1 ) ) { snippet = highlt [ 0 ] ; } } } Document carrotDocument = new Document ( getValue ( sdoc , titleField ) , snippet , ( ( String ) ( sdoc . getFieldValue ( urlField ) ) ) ) ; carrotDocument . setField ( CarrotClusteringEngine . SOLR_DOCUMENT_ID , sdoc . getFieldValue ( idFieldName ) ) ; result . add ( carrotDocument ) ; } return result ; } @ Deprecated protected String getValue ( org . apache . lucene . document . Document doc , String field ) { } protected String getValue ( SolrDocument sdoc , String field ) { } private List < NamedList < Object > > clustersToNamedList ( List < Cluster > carrotClusters , SolrParams solrParams ) { } private void clustersToNamedList ( List < Cluster > outputClusters , List < NamedList < Object > > parent , boolean outputSubClusters , int maxLabels ) { } private void extractCarrotAttributes ( SolrParams solrParams , Map < String , Object > attributes ) { } }

Fix:
if ( produceSummary ) {