Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to get the keyword match number for many categories?
    text
    copied!<p>How to get the keyword match number for many categories?</p> <p>The scenario is that when I type a product keyword, I want to get the match item number in many categories.</p> <p>For example, when I type the keyword "iphone" , the page will show the match item number in many categories:</p> <pre><code>Mobile(5) battery(2) app(6) typeA(2) typeB(9) typeC(15) typeC(1) typeD(9) typeE(7) typeF(8) ...... ...... typeZ(5) public class Product { public int ProductId { get; set; } public string ProductName { get; set; } } public class Type { public int TypeId { get; set; } public string TypeName { get; set; } } public class ProductType { public int ProductId { get; set; } public int TypeId { get; set; } } /// &lt;summary&gt; /// Test Data /// &lt;/summary&gt; public class TestData { public List&lt;Product&gt; GetProductList() { var list = new List&lt;Product&gt;(){ new Product(){ ProductId=1, ProductName = "iphone1"}, new Product(){ ProductId=2, ProductName = "iphone2"}, new Product(){ ProductId=3, ProductName = "iphone3"}, new Product(){ ProductId=4, ProductName = "ipad1"}, new Product(){ ProductId=5, ProductName = "ipad2"}, new Product(){ ProductId=6, ProductName = "mobile1"}, new Product(){ ProductId=7, ProductName = "mobile2"}, new Product(){ ProductId=8, ProductName = "cpu1"}, new Product(){ ProductId=9, ProductName = "cpu2"}, new Product(){ ProductId=10, ProductName = "cpu3"} }; return list; } public List&lt;Type&gt; GetTypeList() { var list = new List&lt;Type&gt;(){ new Type(){ TypeId=1, TypeName = "type1"}, new Type(){ TypeId=2, TypeName = "type2"}, new Type(){ TypeId=3, TypeName = "type3"}, new Type(){ TypeId=4, TypeName = "type4"}, new Type(){ TypeId=5, TypeName = "type5"} }; return list; } public List&lt;ProductType&gt; GetProductTypeList() { var list = new List&lt;ProductType&gt;(){ new ProductType(){ ProductId=1, TypeId=1}, new ProductType(){ ProductId=1, TypeId=2}, new ProductType(){ ProductId=2, TypeId=1}, new ProductType(){ ProductId=2, TypeId=3}, new ProductType(){ ProductId=2, TypeId=4}, new ProductType(){ ProductId=3, TypeId=2}, new ProductType(){ ProductId=3, TypeId=5}, new ProductType(){ ProductId=4, TypeId=2}, new ProductType(){ ProductId=4, TypeId=3}, new ProductType(){ ProductId=4, TypeId=5}, new ProductType(){ ProductId=5, TypeId=2}, new ProductType(){ ProductId=5, TypeId=4}, new ProductType(){ ProductId=6, TypeId=1}, new ProductType(){ ProductId=6, TypeId=2}, new ProductType(){ ProductId=7, TypeId=2}, new ProductType(){ ProductId=7, TypeId=5}, new ProductType(){ ProductId=8, TypeId=2}, new ProductType(){ ProductId=9, TypeId=3}, new ProductType(){ ProductId=10, TypeId=2} }; return list; } </code></pre> <p>How to implement this for a better performance?</p> <p>I use C# ASP.NET.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload