Hello, we have a problem with getting facet from list of nested objects.We need to store list of nested objects and retrieve unique values for them. It seems that TermsFacetFor function is perfect for this purpose.
According to the documentation I've added nested convension in my initialization module:
SearchClient.Instance.Conventions.NestedConventions.ForType().Add(x => x.Makes);
I made index rebuild and after that I tried to retrieve term using following code:
.TermsFacetFor(x => x.Makes, x => x.Make)
But term facet does`t contain any values, through index contains some values.We use Episerver.Find 22.214.171.124, this feature should work for this version. We believe that we missed something so any help will be appreciated.
Try using .ForInstancesOf<> instead of ForType<> (and the reindex). How do you retrieve the facets?
We tried it with .ForInstancesOf<>, but result is still empty
SearchClient.Instance.Conventions.NestedConventions.ForInstancesOf<SearchResultItem>().Add(x => x.Makes);
We are retrieving facets with following code:
var facet = SearchClient.Instance .Search<SearchResultItem>() .TermsFacetFor(x => x.Makes, x => x.Make) .GetResult();
return facet.TermsFacetFor(x => x.Makes, x => x.Make).Select(x => x.Term);
I don't see why your code should not work. Is "Makes" the actual property name, or just an example? If it's an extension method, you'll have to remember to include it via conventions