/// <summary> /// Update the search index with the contents of the section. /// </summary> /// <param name="section"></param> public static void UpdateIndexFromSection(Section section) { CuyahogaContainer container = ContainerAccessorUtil.GetContainer(); // Get ModuleLoader from the container. This needs to happen explicit here because // this is a static method ModuleLoader moduleLoader = container.Resolve <ModuleLoader>(); ISearchService searchService = container.Resolve <ISearchService>(); IContentItemService <ContentItem> contentItemService = container.Resolve <IContentItemService <ContentItem> >(); if (moduleLoader == null) { throw new NullReferenceException("Unable to find the ModuleLoader instance"); } string indexDir = HttpContext.Current.Server.MapPath(Config.GetConfiguration()["SearchIndexDir"]); ModuleBase module = moduleLoader.GetModuleFromSection(section); if (module is ISearchable) { ISearchable searchableModule = module as ISearchable; if (searchableModule != null) { SearchContent[] searchContentList = searchableModule.GetAllSearchableContent(); foreach (SearchContent searchContent in searchContentList) { searchService.UpdateContent(searchContent); } } } //check for IContentItems else { IList <ContentItem> contents = contentItemService.FindContentItemsBySection(section); foreach (ContentItem content in contents) { if (content is ISearchableContent) { searchService.UpdateContent(content); } } } } //end method
public virtual IList <T> FindContentItemsBySection(Section section) { return(_contentItemService.FindContentItemsBySection(section)); }