Hi, I am trying to list all pages of type that have category value set on them.
Code snippet looks like this
var search = _findClient.Search<NewsArticlePage>()
.Filter(x => x.ChangedPublishedDate.BeforeNow())
.FilterForVisitor()
.OrderByDescending(x => x.ChangedPublishedDate);
if (currentBlock.PublishCategories?.Any() ?? false)
{
search = search.MatchCategories(currentBlock.PublishCategories);
}
var result = search.GetContentResult().ToList();
This works fine till the moment new news article gets published. It gets indexed but it doesn't show in the result unless indexing jobs starts manually.
I know that GetContentResult caches and am wondering if there is either a way of invalidating cache during the published event or even better way of getting list of speciffic page type that still uses the latest cache after newly published event.