Try our conversational search powered by Generative AI!

Filtering by contentreferences in contentarea


We have a property RelatedPages that is of type ContentArea and exists on all pages. The property is used to drag'n drop related pages.

We like to use EPiServer Find to filter out pages that has is related to the current page.


var searchResults = SearchClient.Instance.Search()
(x => x.RelatedPages.Items.MatchContained(z => z.ContentLink.ID, currentPage.PageLink.ID)))

This does not yield any results...

We have also tried this without luck:
var searchResults = SearchClient.Instance.Search()
(x => x.RelatedPages.Items.Select(y => y.ContentLink.ID).Match(currentPage.PageLink.ID)))

Any clues what could be wrong?

We have decorated the base class for pages SitePageData with [IndexInContentAreas].

Dec 01, 2014 17:37


Did you solve this problem?

/ Henric

May 08, 2015 16:06

This should do the trick:

var searchResults = SearchClient.Instance.Search<SitePageData>()
                    .Filter(x => x.RelatedPages.ReferencedPermanentLinkIds.Match(currentPage.ContentGuid))
Aug 07, 2015 14:46

Thanks Mari! Old post, but helped me with my filtering issue today :)

Dec 14, 2016 16:34

I have a similar issue although I have a Generic List of Content References and cant seem to get Find to return me results i have tried the following 

searchContext = searchContext.Filter(x => x.Authors.Select(y => y.ID) .Match(author.Value)); 

Nov 03, 2017 11:34
* 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.