Buggy code:
public abstract class AbstractLuceneSpellChecker extends SolrSpellChecker { public static final Logger log = LoggerFactory . getLogger ( AbstractLuceneSpellChecker . class ) ; public static final String SPELLCHECKER_ARG_NAME = "spellchecker" ; public static final String LOCATION = "sourceLocation" ; public static final String INDEX_DIR = "spellcheckIndexDir" ; public static final String ACCURACY = "accuracy" ; public static final String STRING_DISTANCE = "distanceMeasure" ; public static final String FIELD_TYPE = "fieldType" ; public static final String COMPARATOR_CLASS = "comparatorClass" ; public static final String SCORE_COMP = "score" ; public static final String FREQ_COMP = "freq" ; protected String field ; protected String fieldTypeName ; protected SpellChecker spellChecker ; protected String sourceLocation ; protected Directory index ; protected Dictionary dictionary ; public static final int DEFAULT_SUGGESTION_COUNT = 5 ; protected String indexDir ; protected float accuracy = 0.5F ; public static final String FIELD = "field" ; protected StringDistance sd ; @ Override public String init ( NamedList config , SolrCore core ) { } @ Override public SpellingResult getSuggestions ( Collection < Token > tokens , IndexReader reader , int count , boolean onlyMorePopular , boolean extendedResults ) throws IOException { } @ Override public SpellingResult getSuggestions ( SpellingOptions options ) throws IOException { boolean shardRequest = false ; SolrParams params = options . customParams ; if ( params != null ) { shardRequest = "true" . equals ( params . get ( IS_SHARD ) ) ; } SpellingResult result = new SpellingResult ( options . tokens ) ; IndexReader reader = determineReader ( options . reader ) ; Term term = ( ( field ) != null ) ? new Term ( field , "" ) : null ; float theAccuracy = ( ( options . accuracy ) == ( Float . MIN_VALUE ) ) ? spellChecker . getAccuracy ( ) : options . accuracy ; int count = Math . max ( options . count , AbstractLuceneSpellChecker . DEFAULT_SUGGESTION_COUNT ) ; for ( Token token : options . tokens ) { String tokenText = new String ( token . buffer ( ) , 0 , token . length ( ) ) ; String [ ] suggestions = spellChecker . suggestSimilar ( tokenText , count , ( ( field ) != null ? reader : null ) , field , options . onlyMorePopular , theAccuracy ) ; if ( ( ( suggestions . length ) == 1 ) && ( suggestions [ 0 ] . equals ( tokenText ) ) ) { continue ; } if ( ( ( ( options . extendedResults ) == true ) && ( reader != null ) ) && ( ( field ) != null ) ) { term = term . createTerm ( tokenText ) ; <START_BUG> result . add ( token , reader . docFreq ( term ) ) ; <END_BUG> int countLimit = Math . min ( options . count , suggestions . length ) ; if ( countLimit > 0 ) { for ( int i = 0 ; i < countLimit ; i ++ ) { term = term . createTerm ( suggestions [ i ] ) ; result . add ( token , suggestions [ i ] , reader . docFreq ( term ) ) ; } } else if ( shardRequest ) { List < String > suggList = Collections . emptyList ( ) ; result . add ( token , suggList ) ; } } else { if ( ( suggestions . length ) > 0 ) { List < String > suggList = Arrays . asList ( suggestions ) ; if ( ( suggestions . length ) > ( options . count ) ) { suggList = suggList . subList ( 0 , options . count ) ; } result . add ( token , suggList ) ; } else if ( shardRequest ) { List < String > suggList = Collections . emptyList ( ) ; result . add ( token , suggList ) ; } } } return result ; } protected IndexReader determineReader ( IndexReader reader ) { } @ Override public void reload ( SolrCore core , SolrIndexSearcher searcher ) throws IOException { } protected void initIndex ( ) throws IOException { } public float getAccuracy ( ) { } public String getField ( ) { } public String getFieldTypeName ( ) { } public String getIndexDir ( ) { } public String getSourceLocation ( ) { } public StringDistance getStringDistance ( ) { } public SpellChecker getSpellChecker ( ) { } }

Fix:
result . addFrequency ( token , reader . docFreq ( term ) ) ;