Whether is it possible to implement the relation Parent - Child(for example, Has Child Query, elastic) by means of the EPiServer?
Version EPiServer.Find = 8.9.
Can you explain your requirement? Do you want to find out the parent of the current content item? Or do you want to retrive the child items for the current item?
Is any ideas? Or was HasChildQuery implemented in other versions EPiServer.Find?
Currently Find does not support parent child relations.
Henrik, thank you for your reply.
May be is there another way of grouping products and return a single product from the group during the search?
Have you seen Henrik's awesome Nested2Find extension?
It may be what you are looking for?
Ps If you simply want to search based on the number of child items you could add a property to your parent model with the the child item count.
The ChildItemCount will then be indexed and allow you to search on it.
I wrote this to find Child Categories Having Any products under them for refinement. It may give you some direction.
var childCategoriesHavingProducts = new List<ProductListingNode>();
var resultSet = this.GetResultSet(catalogContentId).GetContentResult();
if (resultSet != null && resultSet.Facets != null)
var catTerms = resultSet.TermsFacetFor(x => x.ParentCategories()).Terms.Where(x => x.Count > 0).Select(x => x.Term);
childCategoriesHavingProducts = childCategories.Where(x => catTerms.Contains(x.ContentLink.ToString())).ToList();
Hi DavidThank for your replay.Yes, I seen Henrik's Nested2Find. The post is very good.I use this idea for similar cases.But I think, that groups and products should stored as the independent objects."Ps If you simply want to search based on the number of child items you could add a property to your parent model with the the child item count. The ChildItemCount will then be indexed and allow you to search on it."Unfortunately, but I need get part of the group objects.(not the all products for group)I use the custom implementation for HasChildQuery. Can this affect performance of Epi Find?
Hi Khan,Thank your for your replay.I think, the search for all groups in index and then the filtering on server side will work slower than using EpiFind with custom query(HasChildQuery).May be am I wrong?