* accept result with only beginsWith() in non-strict mode

This commit is contained in:
Reinhard Pointner 2012-07-09 04:21:13 +00:00
parent e184a70e44
commit 70aa36f3b7
1 changed files with 1 additions and 1 deletions

View File

@ -755,7 +755,7 @@ public class CmdlineOperations implements CmdlineInterface {
// find probable matches using name similarity > 0.9 (or > 0.8 in non-strict mode)
for (SearchResult result : searchResults) {
float f = (query == null) ? 1 : metric.getSimilarity(query, result.getName());
if (f >= (strict ? 0.9 : 0.8) || (f >= 0.5 && result.getName().toLowerCase().startsWith(query.toLowerCase()))) {
if (f >= (strict ? 0.9 : 0.8) || ((f >= 0.5 || !strict) && result.getName().toLowerCase().startsWith(query.toLowerCase()))) {
if (!probableMatches.containsKey(result.toString().toLowerCase())) {
probableMatches.put(result.toString().toLowerCase(), result);
}