From bd482562e04bc751e9867066b456316c55a30920 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Thu, 27 Mar 2014 07:40:30 +0000 Subject: [PATCH] * when in doubt, just pick the top 5 most likely hits => never fail in -non-strict mode --- .../net/sourceforge/filebot/cli/CmdlineOperations.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/source/net/sourceforge/filebot/cli/CmdlineOperations.java b/source/net/sourceforge/filebot/cli/CmdlineOperations.java index 81d41106..d34b584a 100644 --- a/source/net/sourceforge/filebot/cli/CmdlineOperations.java +++ b/source/net/sourceforge/filebot/cli/CmdlineOperations.java @@ -860,6 +860,7 @@ public class CmdlineOperations implements CmdlineInterface { return probableMatches; } + @SuppressWarnings("unchecked") public List selectSearchResult(String query, Collection searchResults, boolean strict) throws Exception { List probableMatches = findProbableMatches(query, searchResults, strict); @@ -871,13 +872,10 @@ public class CmdlineOperations implements CmdlineInterface { if (strict) { throw new Exception("Multiple options: Force auto-select requires non-strict matching: " + searchResults); - } else { - if (searchResults.size() > 5) { - throw new Exception("Unable to auto-select search result: " + searchResults); - } else { - return new ArrayList(searchResults); - } } + + // just pick the best 5 matches + probableMatches = (List) sortBySimilarity(searchResults, singleton(query), getSeriesMatchMetric(), false); } // return first and only value