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>();
|
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))
|
var sourceResults = from s in Enum.GetValues(typeof(BuildFeed.Models.TypeOfSource)).Cast<BuildFeed.Models.TypeOfSource>().Select(s => DisplayHelpers.GetDisplayTextForEnum(s))
|
||||||
where s.Contains(query)
|
where s.ToLower().Contains(query.ToLower())
|
||||||
orderby s.IndexOf(query) ascending
|
orderby s.ToLower().IndexOf(query.ToLower()) ascending
|
||||||
select new SearchResult()
|
select new SearchResult()
|
||||||
{
|
{
|
||||||
Url = Url.Route("Source Root", new { controller = "build", action = "source", source = s }),
|
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()
|
var labResults = from l in Build.SelectBuildLabs()
|
||||||
where l.Contains(query)
|
where l.ToLower().Contains(query.ToLower())
|
||||||
orderby l.IndexOf(query) ascending
|
orderby l.ToLower().IndexOf(query.ToLower()) ascending
|
||||||
select new SearchResult()
|
select new SearchResult()
|
||||||
{
|
{
|
||||||
Url = Url.Route("Lab Root", new { controller = "build", action = "lab", lab = l }),
|
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()
|
var buildResults = from b in Build.Select()
|
||||||
where b.FullBuildString.Contains(query)
|
where b.FullBuildString.ToLower().Contains(query.ToLower())
|
||||||
orderby b.FullBuildString.IndexOf(query) ascending,
|
orderby b.FullBuildString.ToLower().IndexOf(query.ToLower()) ascending,
|
||||||
b.BuildTime descending
|
b.BuildTime descending
|
||||||
select new SearchResult()
|
select new SearchResult()
|
||||||
{
|
{
|
||||||
|
|
|
@ -202,7 +202,7 @@ public static IEnumerable<int> SelectBuildYears()
|
||||||
var client = rClient.As<Build>();
|
var client = rClient.As<Build>();
|
||||||
var results = client.GetAll().Where(b => b.BuildTime.HasValue)
|
var results = client.GetAll().Where(b => b.BuildTime.HasValue)
|
||||||
.GroupBy(b => b.BuildTime.Value.Year)
|
.GroupBy(b => b.BuildTime.Value.Year)
|
||||||
.Select(b => b.First().BuildTime.Value.Year)
|
.Select(b => b.Key)
|
||||||
.OrderByDescending(y => y);
|
.OrderByDescending(y => y);
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
@ -217,7 +217,7 @@ public static IEnumerable<string> SelectBuildLabs()
|
||||||
var results = client.GetAll()
|
var results = client.GetAll()
|
||||||
.Where(b => !string.IsNullOrWhiteSpace(b.Lab))
|
.Where(b => !string.IsNullOrWhiteSpace(b.Lab))
|
||||||
.GroupBy(b => b.Lab.ToLower())
|
.GroupBy(b => b.Lab.ToLower())
|
||||||
.Select(b => b.First().Lab.ToLower())
|
.Select(b => b.Key)
|
||||||
.OrderBy(s => s);
|
.OrderBy(s => s);
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
@ -234,7 +234,7 @@ public static IEnumerable<string> SelectBuildLabs(byte major, byte minor)
|
||||||
.Where(b => b.MajorVersion == major)
|
.Where(b => b.MajorVersion == major)
|
||||||
.Where(b => b.MinorVersion == minor)
|
.Where(b => b.MinorVersion == minor)
|
||||||
.GroupBy(b => b.Lab.ToLower())
|
.GroupBy(b => b.Lab.ToLower())
|
||||||
.Select(b => b.First().Lab.ToLower())
|
.Select(b => b.Key)
|
||||||
.OrderBy(s => s);
|
.OrderBy(s => s);
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user