public int slowLookup ( double minScore , String toFind ) { if ( ! frozen ) freeze ( ) ; long start = System . currentTimeMillis ( ) ; StringWrapper wa = softTFIDFDistance . prepare ( toFind ) ; result = new ArrayList ( ) ; for ( Iterator i = valueMap . keySet ( ) . iterator ( ) ; i . hasNext ( ) ; ) { String found = ( String ) i . next ( ) ; StringWrapper wb = softTFIDFDistance . prepare ( found ) ; double d = softTFIDFDistance . score ( wa , wb ) ; if ( d >= minScore ) { Set valset = ( Set ) valueMap . get ( found ) ; for ( Iterator j = valset . iterator ( ) ; j . hasNext ( ) ; ) { String valj = ( String ) j . next ( ) ; result . add ( new LookupResult ( found , valj , d ) ) ; } } } Collections . sort ( result ) ; lookupTime = ( System . currentTimeMillis ( ) - start ) / 1000.0 ; return result . size ( ) ; }
Exactly like lookup but works by exhaustively checking every stored string .