mirror of
https://gitlab.com/buildfeed/BuildFeed.git
synced 2024-03-22 21:10:34 +08:00
Case insensitive searches, hide shoddy selects
This commit is contained in:
parent
2528ee2441
commit
2cdac3d0b1
|
@ -35,8 +35,8 @@ public IEnumerable<SearchResult> GetSearchResult(string query)
|
|||
List<SearchResult> results = new List<SearchResult>();
|
||||
|
||||
var sourceResults = from s in Enum.GetValues(typeof(BuildFeed.Models.TypeOfSource)).Cast<BuildFeed.Models.TypeOfSource>().Select(s => DisplayHelpers.GetDisplayTextForEnum(s))
|
||||
where s.Contains(query)
|
||||
orderby s.IndexOf(query) ascending
|
||||
where s.ToLower().Contains(query.ToLower())
|
||||
orderby s.ToLower().IndexOf(query.ToLower()) ascending
|
||||
select new SearchResult()
|
||||
{
|
||||
Url = Url.Route("Source Root", new { controller = "build", action = "source", source = s }),
|
||||
|
@ -77,8 +77,8 @@ orderby y descending
|
|||
|
||||
|
||||
var labResults = from l in Build.SelectBuildLabs()
|
||||
where l.Contains(query)
|
||||
orderby l.IndexOf(query) ascending
|
||||
where l.ToLower().Contains(query.ToLower())
|
||||
orderby l.ToLower().IndexOf(query.ToLower()) ascending
|
||||
select new SearchResult()
|
||||
{
|
||||
Url = Url.Route("Lab Root", new { controller = "build", action = "lab", lab = l }),
|
||||
|
@ -91,8 +91,8 @@ orderby l.IndexOf(query) ascending
|
|||
|
||||
|
||||
var buildResults = from b in Build.Select()
|
||||
where b.FullBuildString.Contains(query)
|
||||
orderby b.FullBuildString.IndexOf(query) ascending,
|
||||
where b.FullBuildString.ToLower().Contains(query.ToLower())
|
||||
orderby b.FullBuildString.ToLower().IndexOf(query.ToLower()) ascending,
|
||||
b.BuildTime descending
|
||||
select new SearchResult()
|
||||
{
|
||||
|
|
|
@ -202,7 +202,7 @@ public static IEnumerable<int> SelectBuildYears()
|
|||
var client = rClient.As<Build>();
|
||||
var results = client.GetAll().Where(b => b.BuildTime.HasValue)
|
||||
.GroupBy(b => b.BuildTime.Value.Year)
|
||||
.Select(b => b.First().BuildTime.Value.Year)
|
||||
.Select(b => b.Key)
|
||||
.OrderByDescending(y => y);
|
||||
return results;
|
||||
}
|
||||
|
@ -217,7 +217,7 @@ public static IEnumerable<string> SelectBuildLabs()
|
|||
var results = client.GetAll()
|
||||
.Where(b => !string.IsNullOrWhiteSpace(b.Lab))
|
||||
.GroupBy(b => b.Lab.ToLower())
|
||||
.Select(b => b.First().Lab.ToLower())
|
||||
.Select(b => b.Key)
|
||||
.OrderBy(s => s);
|
||||
return results;
|
||||
}
|
||||
|
@ -234,7 +234,7 @@ public static IEnumerable<string> SelectBuildLabs(byte major, byte minor)
|
|||
.Where(b => b.MajorVersion == major)
|
||||
.Where(b => b.MinorVersion == minor)
|
||||
.GroupBy(b => b.Lab.ToLower())
|
||||
.Select(b => b.First().Lab.ToLower())
|
||||
.Select(b => b.Key)
|
||||
.OrderBy(s => s);
|
||||
return results;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user