With the nested Category structure of uCommerce, I want to have facets for the category being displayed but also to include an child categories. I've tried a couple of approaches, none of which have worked. This is a couple of things I've tried, has anyone got this working before:
var currentCategory = SiteContext.Current.CatalogContext.CurrentCategory;
//get the child category id's and also add the current category Id to the list
var allIds = currentCategory.Categories.Select(x => x.CategoryId).ToList();
allIds.Add(category.CategoryId);
//attempt 1 using custom Facet Search - throws Raven DB not supported exception
var facetResults =
SearchLibrary.FacetedQuery()
.Where(x => x.CategoryIds.Intersect(allIds).Any())
.ToFacets()
.ToList();
//attempt 2 with custom facet
var facet = new Facet();
facet.FacetValues = new List<FacetValue>();
facet.Name = "Category";
facet.DisplayName = facet.Name;
foreach (var value in allIds)
{
facet.FacetValues.Add(new FacetValue() { Value = value.ToString() });
}
facets.Add(facet);
//No results are returned here
var results = SearchLibrary.FacetedQuery().WithFacets(facets).ToList();
uCommerce get Facets for multiple categories
With the nested Category structure of uCommerce, I want to have facets for the category being displayed but also to include an child categories. I've tried a couple of approaches, none of which have worked. This is a couple of things I've tried, has anyone got this working before:
is working on a reply...