Vulnerability in EPiServer.Forms

Try our conversational search powered by Generative AI!

Facets on nested classes



we custom indexing our Commerce catalog.  The items that we need to build facets on are in the nested classes.


public GameProduct


    public List varients;


public GameVarient


 public List Countries;

public int Genre;


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.


Jan 26, 2015 18:00

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))

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.

Jan 29, 2015 8:56


I've written a gist with TermsFacet-extensions that supports nested objects:


Feb 04, 2015 13:53

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!

Feb 06, 2015 12:24


Were you able to build facets on the List Countries of the nested class? Did you end up making your own solution for it?

Jul 26, 2017 18:52
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.