Try searching for IContent instead of SitePageData
SearchClient.Instance.Search<IContent>()
That would get you all types of content.
If you want to filter out only pages and blocks I think you could do it this way.
SearchClient.Instance.Search<IContent>()
.Filter(x => x.ChangedBy.Match(currentUser))
.Filter(x => x.IsPageOrBlock())
.Take(10)
.GetContentResult().ToList();
public static class CustomFilters
{
public static FilterExpression<IContent> IsPageOrBlock(this IContent content)
{
return new FilterExpression<IContent>(x =>
x.MatchTypeHierarchy(typeof(PageData))
| x.MatchTypeHierarchy(typeof(BlockData)));
}
}
Hi Peter,
Block is not inherited form IContent so ChangedBy prop. doesnt work exist in this case.
However, i moved further by converting each result as IChangeTrackable. then i could read changedby even for blocks.
Now i am stucked at a point, the changed blocks or pages are only those are recently changed and published and not that are changed and saved.
Seems like i need to check all versions of content and maybe Epi Find is not a place to look into it then instead Maybe i should take help from ContentRepository.
Will update, and please update here if you have any hints.
thanks for help.
.Filter(x => x.IsPageOrBlock())
.Filter(x => x.ChangedBy.Match(currentUser))
Hi, im working on writing a find query that returns recentlt edited contentItems by current user. I need to read both pages and blocks. With this query i easily get PageData but not Block data. Any help? I've seen REcentlyChanged component in epi-cms/ but thats too complicate to understand at the moment.