Buggy code:
public class SpellChecker { public static final String F_WORD = "word" ; Directory spellindex ; private float bStart = 2.0F ; private float bEnd = 1.0F ; private IndexReader reader ; float min = 0.5F ; public void setSpellIndex ( Directory spellindex ) { } public void setAccuraty ( float min ) { } public SpellChecker ( Directory gramIndex ) { } public String [ ] suggestSimilar ( String word , int num_sug ) throws IOException { } public String [ ] suggestSimilar ( String word , int num_sug , IndexReader ir , String field , boolean morePopular ) throws IOException { final TRStringDistance sd = new TRStringDistance ( word ) ; final int lengthWord = word . length ( ) ; final int goalFreq = ( morePopular && ( ir != null ) ) ? ir . docFreq ( new Term ( field , word ) ) : 0 ; if ( ( ! morePopular ) && ( goalFreq > 0 ) ) { return new String [ ] { word } ; } BooleanQuery query = new BooleanQuery ( ) ; String [ ] grams ; String key ; for ( int ng = getMin ( lengthWord ) ; ng <= ( getMax ( lengthWord ) ) ; ng ++ ) { key = "gram" + ng ; grams = SpellChecker . formGrams ( word , ng ) ; if ( ( grams . length ) == 0 ) { continue ; } if ( ( bStart ) > 0 ) { SpellChecker . add ( query , ( "start" + ng ) , grams [ 0 ] , bStart ) ; } if ( ( bEnd ) > 0 ) { SpellChecker . add ( query , ( "end" + ng ) , grams [ ( ( grams . length ) - 1 ) ] , bEnd ) ; } for ( int i = 0 ; i < ( grams . length ) ; i ++ ) { SpellChecker . add ( query , key , grams [ i ] ) ; } } IndexSearcher searcher = new IndexSearcher ( this . spellindex ) ; Hits hits = searcher . search ( query ) ; SuggestWordQueue sugqueue = new SuggestWordQueue ( num_sug ) ; int stop = Math . min ( hits . length ( ) , ( 10 * num_sug ) ) ; SuggestWord sugword = new SuggestWord ( ) ; for ( int i = 0 ; i < stop ; i ++ ) { sugword . string = hits . doc ( i ) . get ( SpellChecker . F_WORD ) ; <START_BUG> if ( ( sugword . string ) == word ) { <END_BUG> continue ; } sugword . score = 1.0F - ( ( ( float ) ( sd . getDistance ( sugword . string ) ) ) // ( Math . min ( sugword . string . length ( ) , lengthWord ) ) ) ; if ( ( sugword . score ) < ( min ) ) { continue ; } if ( ir != null ) { sugword . freq = ir . docFreq ( new Term ( field , sugword . string ) ) ; if ( ( morePopular && ( goalFreq > ( sugword . freq ) ) ) || ( ( sugword . freq ) < 1 ) ) { continue ; } } sugqueue . insert ( sugword ) ; if ( ( sugqueue . size ( ) ) == num_sug ) { min = ( ( SuggestWord ) ( sugqueue . top ( ) ) ) . score ; } sugword = new SuggestWord ( ) ; } String [ ] list = new String [ sugqueue . size ( ) ] ; for ( int i = ( sugqueue . size ( ) ) - 1 ; i >= 0 ; i -- ) { list [ i ] = ( ( SuggestWord ) ( sugqueue . pop ( ) ) ) . string ; } searcher . close ( ) ; return list ; } private static void add ( BooleanQuery q , String k , String v , float boost ) { } private static void add ( BooleanQuery q , String k , String v ) { } private static String [ ] formGrams ( String text , int ng ) { } public void clearIndex ( ) throws IOException { } public boolean exist ( String word ) throws IOException { } public void indexDictionary ( Dictionary dict ) throws IOException { } private int getMin ( int l ) { } private int getMax ( int l ) { } private static Document createDocument ( String text , int ng1 , int ng2 ) { } private static void addGram ( String text , Document doc , int ng1 , int ng2 ) { } protected void finalize ( ) throws Throwable { } }

Fix:
if ( sugword . string . equals ( word ) ) {