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() .Filter( (x => x.RelatedPages.Items.MatchContained(z => z.ContentLink.ID, currentPage.PageLink.ID))) .GetContentResult();
This does not yield any results...
We have also tried this without luck: var searchResults = SearchClient.Instance.Search() .Filter( (x => x.RelatedPages.Items.Select(y => y.ContentLink.ID).Match(currentPage.PageLink.ID))) .GetContentResult();
Any clues what could be wrong?
We have decorated the base class for pages SitePageData with [IndexInContentAreas].
Did you solve this problem?
This should do the trick:
var searchResults = SearchClient.Instance.Search<SitePageData>()
.Filter(x => x.RelatedPages.ReferencedPermanentLinkIds.Match(currentPage.ContentGuid))
Thanks Mari! Old post, but helped me with my filtering issue today :)
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));