Revert a breaking change to fuzzy item/block lookup.

This commit is contained in:
wizjany 2014-04-26 00:21:05 -04:00
parent 5ed9239e14
commit b0a52a4cf7

View File

@ -289,7 +289,7 @@ public final class StringUtil {
return null; return null;
} }
int minDist = Integer.MAX_VALUE; int minDist = -1;
for (Map.Entry<String, T> entry : lookup.entrySet()) { for (Map.Entry<String, T> entry : lookup.entrySet()) {
final String key = entry.getKey(); final String key = entry.getKey();
@ -299,16 +299,12 @@ public final class StringUtil {
int dist = getLevenshteinDistance(key, testName); int dist = getLevenshteinDistance(key, testName);
if (dist >= minDist) { if ((dist < minDist || minDist == -1) && dist < 2) {
minDist = dist; minDist = dist;
type = entry.getValue(); type = entry.getValue();
} }
} }
if (minDist > 1) {
return null;
}
return type; return type;
} }
} }