AI OnAI Off
Afaik, you need to extend your model (MyPages) in order to Filter on parent page type.
Add a property to MyPages "ParentPageType" similar to this (code simplified) and use that property in your filter.
public int ParentPageTypeId { get { var parentPage = myContentLoader.Get<SitePageData>(this.ParentLink); return parentPage.PageTypeID; } }
Hi Mari,
I tried to implement this use case of matching parent (container) page type and EpiFind 12.2.4.0 ignore it (returns nothing).
Do I miss something, because it doesn't call this property ParentPageTypeId during debugging?
Maybe some required Conventions needs to be included?
var newsContainerContentTypeId = _contentTypeRepository.Load<NewsContainerPage>().ID; var dynamicSearchResult = _epiFindClient .DynamicMultiSearch() .Search<ArticlePage>(x => x .Filter(f => f.Name.AnyWordBeginsWith(searchTerm) | f.MainBody.AnyWordBeginsWith(searchTerm)) .Filter(f => f.ParentPageTypeId.Match(newsContainerContentTypeId)) .Take(numberOfItemsInEachGroup)) .GetDynamicResult();
Thanks
---------------------------
I figured out, I was missing this convention in Application_Start event.
EpiFind uses this custom property only during indexing and after just matching the indexed value in Filter() method.
SearchClient.Instance.Conventions.ForInstancesOf<ContentPageBase>().IncludeField(x => x.ParentPageTypeId);
Hi,
Can you filter out pages who's parent page is not a certain pageType. Basically, in the main site search I dont want to show pages who's Parent is a Member PageType.
Pseudo code example:
_client.Search()
.Filter(
r =>
(r.ParentPage.PageType
) != MemeberPageType
Thanks
Jon