public IndexedModelResult FillIndex() { try { var homePage = Umbraco.Web.Composing.Current.UmbracoHelper.ContentAtRoot().First(pc => pc.ContentType.Alias.Equals(_documentTypeAliasProvider.GetHomePage())); var contentPages = homePage.DescendantsOfType(_documentTypeAliasProvider.GetArticlePage()); var searchableContents = contentPages .Where(pc => _searchUmbracoHelper.IsSearchable(pc)) .Select(_searchUmbracoHelper.GetContent); _contentIndex.Index(searchableContents); return(_indexerDiagnosticService.GetSuccessResult(typeof(ContentIndexer).Name, searchableContents)); } catch (Exception e) { return(_indexerDiagnosticService.GetFailedResult(e.Message + e.StackTrace, typeof(ContentIndexer).Name)); } }
public IEnumerable <IPublishedContent> GetAllContentPages() { var contentPages = GetDescendants(_baseXPath.Append(_documentTypeAliasProvider.GetArticlePage())).ToList(); return(contentPages); }
public bool IsSearchable(IPublishedContent content) { var isContentPage = content.ContentType.Alias.Equals(_documentTypeAliasProvider.GetArticlePage()); return(isContentPage && content.GetProperty("includeInSearch").Value <bool>()); }