/// <summary> /// Adds search index to site. Called when the "Add index to site" button is pressed. /// Expects the CreateSearchIndex method to be run first. /// </summary> private bool UpdateIndex() { // Tree provider TreeProvider provider = new CMS.TreeEngine.TreeProvider(CMS.CMSHelper.CMSContext.CurrentUser); // Get document of specified site, aliaspath and culture TreeNode node = provider.SelectSingleNode(CMS.CMSHelper.CMSContext.CurrentSiteName, "/", "en-us"); // If node exists if ((node != null) && (node.PublishedVersionExists) && (SearchIndexInfoProvider.SearchEnabled)) { // Edit and save document node node.NodeDocType += " changed"; node.Update(); // Create update task SearchTaskInfoProvider.CreateTask(SearchTaskTypeEnum.Update, PredefinedObjectType.DOCUMENT, SearchHelper.ID_FIELD, node.GetSearchID()); return(true); } return(false); }
/// <summary> /// Adds search index to site. Called when the "Add index to site" button is pressed. /// Expects the CreateSearchIndex method to be run first. /// </summary> private bool UpdateIndex() { // Tree provider TreeProvider provider = new CMS.TreeEngine.TreeProvider(CMS.CMSHelper.CMSContext.CurrentUser); // Get document of specified site, aliaspath and culture TreeNode node = provider.SelectSingleNode(CMS.CMSHelper.CMSContext.CurrentSiteName, "/", "en-us"); // If node exists if ((node != null) && (node.PublishedVersionExists) && (SearchIndexInfoProvider.SearchEnabled)) { // Edit and save document node node.NodeDocType += " changed"; node.Update(); // Create update task SearchTaskInfoProvider.CreateTask(SearchTaskTypeEnum.Update, PredefinedObjectType.DOCUMENT, SearchHelper.ID_FIELD, node.GetSearchID()); return true; } return false; }