Fixed: Search results from trakt are now sorted based on similarity with the search query.

Using a Levenshtein distance algorithm.
This commit is contained in:
Taloth Saldono
2014-05-30 22:36:38 +02:00
parent 50303ce470
commit e28123eefd
5 changed files with 110 additions and 1 deletions
@@ -35,7 +35,9 @@ namespace NzbDrone.Core.MetadataSource
var restRequest = new RestRequest(GetSearchTerm(title) + "/30/seasons");
var response = client.ExecuteAndValidate<List<Show>>(restRequest);
return response.Select(MapSeries).ToList();
return response.Select(MapSeries)
.OrderBy(v => title.LevenshteinDistanceClean(v.Title))
.ToList();
}
catch (WebException ex)
{