diff --git a/Shoko.Server/Utilities/SeriesSearch.cs b/Shoko.Server/Utilities/SeriesSearch.cs index 0361ed9a2..5f1ff0e68 100644 --- a/Shoko.Server/Utilities/SeriesSearch.cs +++ b/Shoko.Server/Utilities/SeriesSearch.cs @@ -197,7 +197,7 @@ public static List> SearchSeries(SVR_JMMUser user, var forbiddenTags = user.GetHideCategories(); //search by anime id - if (int.TryParse(query, out int animeID)) + if (int.TryParse(query, out var animeID)) { var series = RepoFactory.AnimeSeries.GetByAnimeID(animeID); var anime = series.GetAnime(); @@ -205,7 +205,7 @@ public static List> SearchSeries(SVR_JMMUser user, if (anime != null && !tags.FindInEnumerable(forbiddenTags)) return new List> { - new SearchResult + new() { ExactMatch = true, Match = series.AniDB_ID.ToString(), @@ -284,7 +284,7 @@ private static List> SearchTagsExact(string query, var series = RepoFactory.AnimeSeries.GetByAnimeID(xref.CrossRefID); var anime = series?.GetAnime(); var tags = anime?.GetAllTags(); - if (anime == null || (tags.Count == 0 || tags.FindInEnumerable(forbiddenTags))) + if (anime == null || tags.Count == 0 || tags.FindInEnumerable(forbiddenTags)) return null; return new SearchResult @@ -310,7 +310,7 @@ private static List> SearchTagsExact(string query, var series = RepoFactory.AnimeSeries.GetByAnimeID(xref.AnimeID); var anime = series?.GetAnime(); var tags = anime?.GetAllTags(); - if (anime == null || (tags.Count == 0 || tags.FindInEnumerable(forbiddenTags))) + if (anime == null || tags.Count == 0 || tags.FindInEnumerable(forbiddenTags)) return null; return new SearchResult @@ -358,7 +358,7 @@ private static List> SearchTagsFuzzy(string query, var series = RepoFactory.AnimeSeries.GetByAnimeID(xref.CrossRefID); var anime = series?.GetAnime(); var tags = anime?.GetAllTags(); - if (anime == null || (tags.Count == 0 || tags.FindInEnumerable(forbiddenTags))) + if (anime == null || tags.Count == 0 || tags.FindInEnumerable(forbiddenTags)) return null; return new SearchResult @@ -396,7 +396,7 @@ private static List> SearchTagsFuzzy(string query, var series = RepoFactory.AnimeSeries.GetByAnimeID(xref.AnimeID); var anime = series?.GetAnime(); var tags = anime?.GetAllTags(); - if (anime == null || (tags.Count == 0 || tags.FindInEnumerable(forbiddenTags))) + if (anime == null || tags.Count == 0 || tags.FindInEnumerable(forbiddenTags)) return null; return new SearchResult @@ -492,19 +492,19 @@ public int CompareTo(SearchResult other) if (otherIsEmpty) return -1; - int exactMatchComparison = ExactMatch == other.ExactMatch ? 0 : ExactMatch ? -1 : 1; + var exactMatchComparison = ExactMatch == other.ExactMatch ? 0 : ExactMatch ? -1 : 1; if (exactMatchComparison != 0) return exactMatchComparison; - int indexComparison = Index.CompareTo(other.Index); + var indexComparison = Index.CompareTo(other.Index); if (indexComparison != 0) return indexComparison; - int distanceComparison = Distance.CompareTo(other.Distance); + var distanceComparison = Distance.CompareTo(other.Distance); if (distanceComparison != 0) return distanceComparison; - int lengthDifferenceComparison = LengthDifference.CompareTo(other.LengthDifference); + var lengthDifferenceComparison = LengthDifference.CompareTo(other.LengthDifference); if (lengthDifferenceComparison != 0) return lengthDifferenceComparison;