Hi!
I have a collection of products and by convention we've added the variants as a property so they are indexed together.
What I'd like to do is project over the results and get the cheapest variant in order to retreive some data to be displayed. This prevents me from loading all variants when the search results.
Is it possible, when projecting, to filter a nested collection?
Example:
Client.Search()
.Filter(x => x.Code.Match("8801141522433"))
.FilterPriceAvailableForCurrentUser()
.Select(p => new
{
Code = p.Code,
SpecificationsList = p.ProductVariations.FirstOrDefault(v => v.Code == p.CheapestVariationCode).Specifications })
.GetResult();
The SpecificationsList is always empty because Find cannot interpret the FirstOrDefault method I guess but I can't Filter there either.
Thanks for helping out!
/Mark