mirror of
https://github.com/ppy/osu.git
synced 2025-01-27 17:53:15 +08:00
Expose searchable terms from beatmap info instead
This commit is contained in:
parent
5186da8412
commit
401c516503
@ -149,6 +149,11 @@ namespace osu.Game.Beatmaps
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string[] SearchableTerms => new[]
|
||||||
|
{
|
||||||
|
Version
|
||||||
|
}.Concat(Metadata?.SearchableTerms ?? Enumerable.Empty<string>()).Where(s => !string.IsNullOrEmpty(s)).ToArray();
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
string version = string.IsNullOrEmpty(Version) ? string.Empty : $"[{Version}]";
|
string version = string.IsNullOrEmpty(Version) ? string.Empty : $"[{Version}]";
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Screens.Select.Filter;
|
using osu.Game.Screens.Select.Filter;
|
||||||
@ -55,13 +54,10 @@ namespace osu.Game.Screens.Select.Carousel
|
|||||||
|
|
||||||
if (match)
|
if (match)
|
||||||
{
|
{
|
||||||
var terms = new List<string>();
|
var terms = Beatmap.SearchableTerms;
|
||||||
|
|
||||||
terms.AddRange(Beatmap.Metadata.SearchableTerms);
|
|
||||||
terms.Add(Beatmap.Version);
|
|
||||||
|
|
||||||
foreach (var criteriaTerm in criteria.SearchTerms)
|
foreach (var criteriaTerm in criteria.SearchTerms)
|
||||||
match &= terms.Any(term => term?.IndexOf(criteriaTerm, StringComparison.InvariantCultureIgnoreCase) >= 0);
|
match &= terms.Any(term => term.IndexOf(criteriaTerm, StringComparison.InvariantCultureIgnoreCase) >= 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
Filtered.Value = !match;
|
Filtered.Value = !match;
|
||||||
|
Loading…
Reference in New Issue
Block a user