Exemplo n.º 1
0
    public void RaisePostBackEvent(string eventArgument)
    {
        // Rebuild search index
        if (SearchIndexInfoProvider.SearchEnabled)
        {
            SiteInfo si = SiteInfoProvider.GetSiteInfo(siteId);
            if (si != null)
            {
                // Get all indexes depending on given site
                DataSet result = SearchIndexSiteInfoProvider.GetSiteSearchIndexes(si.SiteID);

                if (!DataHelper.DataSourceIsEmpty(result))
                {
                    List <string>   items = new List <string>();
                    SearchIndexInfo sii   = null;

                    // Add all indexes to rebuild queue
                    foreach (DataRow dr in result.Tables[0].Rows)
                    {
                        sii = SearchIndexInfoProvider.GetSearchIndexInfo((int)dr["IndexID"]);
                        if (sii != null)
                        {
                            items.Add(sii.IndexName);
                        }
                    }

                    // Rebuild all indexes
                    SearchTaskInfoProvider.CreateMultiTask(SearchTaskTypeEnum.Rebuild, null, null, items, true);
                }
            }

            lblInfo.Text    = GetString("srch.index.rebuildstarted");
            lblInfo.Visible = true;
        }
    }