Hi, i'm new to dotnet and i'm having an error trying to modify ProductService.cs SearchProductAsync:
productsByKeywords =
from p in _productRepository.Table
where p.Name.Contains(keywords) ||
(searchDescriptions &&
(p.ShortDescription.Contains(keywords) || p.FullDescription.Contains(keywords))) ||
(searchManufacturerPartNumber && p.ManufacturerPartNumber == keywords) ||
(searchSku && p.Sku.Contains(keywords))
select p.Id;
I need to split keywords in words (string list) and p.Name should contain all the words in keywords
i.e.
keywords = "shirt blue"
p.name = "this shirt is very blue" should match
I'm having an error LinqException: Sequence 'value(Nop.Services.Catalog.ProductService+<>c__DisplayClass55_1).keywordsList' cannot be converted to SQL.
IQueryable<int> productsByKeywords;
List<string> keywordsList = keywords.Split(',').ToList();
productsByKeywords =
from p in _productRepository.Table
where keywordsList.All(aname => p.Name.Contains(aname)) ||
(searchDescriptions &&
(p.ShortDescription.Contains(keywords) || p.FullDescription.Contains(keywords))) ||
(searchManufacturerPartNumber && p.ManufacturerPartNumber == keywords) ||
(searchSku && p.Sku.Contains(keywords))
select p.Id;
Thank you