Skip to content

Commit

Permalink
fix: return all subjects after sorted by fuzzy
Browse files Browse the repository at this point in the history
  • Loading branch information
chu-shen authored and kookxiang committed Oct 8, 2024
1 parent 6c7a5f1 commit 670bdb7
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Jellyfin.Plugin.Bangumi/BangumiApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,13 @@ public async Task<List<Subject>> SearchSubject(string keyword, SubjectType? type

if (Plugin.Instance!.Configuration.SortByFuzzScore && list.Count > 2)
{
// 仅使用前 5 个条目
var tasks = list.Take(5).Select(subject => GetSubject(subject.Id, token));
// 仅使用前 5 个条目获取别名并排序
var num = 5;
var tasks = list.Take(num).Select(subject => GetSubject(subject.Id, token));
var subjectWithInfobox = await Task.WhenAll(tasks);

return Subject.SortByFuzzScore(subjectWithInfobox.Where(s => s != null).Cast<Subject>().ToList(), keyword);
var sortedSubjects = Subject.SortByFuzzScore(subjectWithInfobox.Where(s => s != null).Cast<Subject>().ToList(), keyword);
return sortedSubjects.Concat(list.Skip(num)).ToList();
}
return Subject.SortBySimilarity(list, keyword);
}
Expand Down

0 comments on commit 670bdb7

Please sign in to comment.