November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
First of all your products and variants should inherit from ProductContent and VariantContent. Then all fields you want to be indexed add as properties (not fields). Use "get" only properties for fields which are "calculated" - in your case Variants in GameProduct. The result should look like:
public class GameProduct : ProductContent { public List<GameVariant> Variants { get { var loader = ServiceLocator.Current.GetInstance<IContentLoader>(); return this.GetVariantRelations() .Select(relation => loader.Get<VariationContent>(relation.Target)) .ToList(); } } } public class GameVariant : VariationContent { public int Genre { get; set; } }
Now EPiServer Find should be able to index Variants property of GameProduct.
But I would suggest you better to search variants, not products. Then you can build Genre facets and do filtering on countries. If you need product, you can get matching one for variant.
Hi,
I've written a gist with TermsFacet-extensions that supports nested objects: https://gist.github.com/lindstromhenrik/30391262cf166a07f451
/Henrik
Hi all,
Maris, I agree. The sample here is a simplified version and we need to be able to build facets on nested properties.
Thanks Henrik, it work perfectly!
Daniel,
Were you able to build facets on the List Countries of the nested class? Did you end up making your own solution for it?
Hi,
we custom indexing our Commerce catalog. The items that we need to build facets on are in the nested classes.
e.g.
The search indexes the GameProduct and we would like to build facets based on the Genre in the GameVarient class.
It seems that this is not possible to do in EPiServer Find although its possible in Elastic Search?
A solution would be to roll up the Genre to the top level class, but unfortunately we perform filtering on the countries.
Any help or feedback would be appreciated.
Thanks