Closed charlondelacruz closed 3 years ago
Hi @charlondelacruz
Thanks for getting in touch... unfortunately there is currently no easy way to perform the search above in one line of code in SearchExtensions... the best I think you can do is as follows:
var named = context.Products.Search(x => x.Name).ContainingAll(keywords);
var skuMatch = context.Products.Search(x => x.SkuId).Containing(keywords);
From here you could merge the two collections, deduplicate based on SkuId
and grab your count, however it does result in an extra call to the db so would likely lose you some efficiencies.
First, of all I would like to thank you for this awesome library. I've been using this library just recently and it works great on my end.
I just want to ask if this kind of search is supported. I tried the chain search but no luck maybe because I'm missing the OR clause.
var total = context.Products.Where(x => keywords.All(k => x.Name.Contains(k)) || keywords.Any(k => x.SkuId.Contains(k))).Count();