Using the Search with GetContentResult, I have a convention for the Product:
public static List<string> SizesOfShoe(this ProductContent product) =>
ProductService.GetVariantsOrEmpty(product.ContentLink).Select(Size.ShoeSize).Select(x => x.Value).ToList();
That is applied as a convention:
conventionBuilder.IncludeField(x => x.SizesOfShoe());
Now, when I just use the TermsFacetFor(x => x.SizesOfShoe()) then I get proper results and TermsFacets has all the options with proper counts.
However, when I want to filter by the ShoeSize then I end up with no results.
The filter I'm creating is as following:
if (Criteria.ShoeSizes?.Any() ?? false)
var filter = client.BuildFilter<ClientProduct>();
foreach (var size in Criteria.ShoeSizes) filter = filter.Or(x => x.SizesOfShoe().MatchContained(y => y, size));
q = q.Filter(filter);
ShoeSizes in Criteria is an IEnumerable<string>.
Am I doing something wrong? Case sensitivity is not an issue here since I'm dealing with numbers here (which are under strings).
q = q.Filter(x=> x.SizesOfShoe().In(Criteria.ShoeSizes, true))
Yes, Farhana, that works like a charm, thank you!