/// <summary> /// Removes culture from search index. Called when the "Remove culture from index" button is pressed. /// Expects the AddCultureToSearchIndex method to be run first. /// </summary> private bool RemoveCultureFromSearchIndex() { // Get the search index SearchIndexInfo removeIndex = SearchIndexInfoProvider.GetSearchIndexInfo("MyNewIndex"); CultureInfo culture = CultureInfoProvider.GetCultureInfo("en-us"); if ((removeIndex != null) && (culture != null)) { // Get the binding SearchIndexCultureInfo indexCulture = SearchIndexCultureInfoProvider.GetSearchIndexCultureInfo(removeIndex.IndexID, culture.CultureID); // Delete the binding SearchIndexCultureInfoProvider.DeleteSearchIndexCultureInfo(indexCulture); return(true); } return(false); }
protected void uniSelector_OnSelectionChanged(object sender, EventArgs e) { // Remove old items string newValues = ValidationHelper.GetString(uniSelector.Value, null); string items = DataHelper.GetNewItemsInList(newValues, currentValues); if (!String.IsNullOrEmpty(items)) { string[] newItems = items.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); if (newItems != null) { // Remove all new items foreach (string item in newItems) { int cultureId = ValidationHelper.GetInteger(item, 0); SearchIndexCultureInfo sici = SearchIndexCultureInfoProvider.GetSearchIndexCultureInfo(indexId, cultureId); SearchIndexCultureInfoProvider.DeleteSearchIndexCultureInfo(sici); } } } // Add new items items = DataHelper.GetNewItemsInList(currentValues, newValues); if (!String.IsNullOrEmpty(items)) { string[] newItems = items.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); if (newItems != null) { // Add all new items foreach (string item in newItems) { int cultureId = ValidationHelper.GetInteger(item, 0); SearchIndexCultureInfoProvider.AddSearchIndexCulture(indexId, cultureId); } } } // Show saved message with rebuild link ShowChangesSaved(); ShowInformation(String.Format(GetString("srch.indexrequiresrebuild"), "<a href=\"javascript:" + Page.ClientScript.GetPostBackEventReference(this, "saved") + "\">" + GetString("General.clickhere") + "</a>")); }
protected void uniSelector_OnSelectionChanged(object sender, EventArgs e) { // Remove old items string newValues = ValidationHelper.GetString(uniSelector.Value, null); string items = DataHelper.GetNewItemsInList(newValues, currentValues); if (!String.IsNullOrEmpty(items)) { string[] newItems = items.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); if (newItems != null) { // Remove all new items foreach (string item in newItems) { int cultureId = ValidationHelper.GetInteger(item, 0); SearchIndexCultureInfo sici = SearchIndexCultureInfoProvider.GetSearchIndexCultureInfo(indexId, cultureId); SearchIndexCultureInfoProvider.DeleteSearchIndexCultureInfo(sici); } } } // Add new items items = DataHelper.GetNewItemsInList(currentValues, newValues); if (!String.IsNullOrEmpty(items)) { string[] newItems = items.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); if (newItems != null) { // Add all new items foreach (string item in newItems) { int cultureId = ValidationHelper.GetInteger(item, 0); SearchIndexCultureInfoProvider.AddSearchIndexCulture(indexId, cultureId); } } } // Show saved message with rebuild link lblInfo.Visible = true; }