react-version #1
@ -42,16 +42,16 @@ public class SearchController : Controller {
|
||||
query = query.ToLower();
|
||||
|
||||
foreach (Product prod in _searchCache) {
|
||||
string sTitle = prod.Title.Replace(".", " ").Replace(",", " ").ToLower(),
|
||||
sCat = prod.Category.Replace(".", " ").Replace(",", " ").ToLower(),
|
||||
string sTitle = prod.Title.Replace(",", " ").ToLower(),
|
||||
sCat = prod.Category.ToLower(),
|
||||
sDesc = prod.Description.Replace(".", " ").Replace(",", " ").ToLower();
|
||||
if (sTitle.StartsWith(query))
|
||||
products.Add(prod);
|
||||
else if (sTitle.Contains(" " + query + " "))
|
||||
title.Add(prod);
|
||||
else if (sDesc.Contains(" " + query + " "))
|
||||
else if (sDesc.StartsWith(query) || sDesc.Contains(" " + query + " "))
|
||||
desc.Add(prod);
|
||||
else if (sCat.Contains(" " + query + " "))
|
||||
else if (sCat.Contains(query))
|
||||
cat.Add(prod);
|
||||
}
|
||||
products.AddRange(title);
|
||||
|
Loading…
Reference in New Issue
Block a user