Esempio n. 1
0
    public void RaisePostBackEvent(string eventArgument)
    {
        if (eventArgument == "saved")
        {
            SearchIndexInfo sii = SearchIndexInfoProvider.GetSearchIndexInfo(ItemID);
            if (sii.IndexType.Equals(Treenode.OBJECT_TYPE, StringComparison.OrdinalIgnoreCase) || (sii.IndexType == SearchHelper.DOCUMENTS_CRAWLER_INDEX))
            {
                if (!SearchIndexCultureInfoProvider.SearchIndexHasAnyCulture(sii.IndexID))
                {
                    ShowError(GetString("index.noculture"));
                    return;
                }

                if (!SearchIndexSiteInfoProvider.SearchIndexHasAnySite(sii.IndexID))
                {
                    ShowError(GetString("index.nosite"));
                    return;
                }
            }

            if (SearchHelper.CreateRebuildTask(ItemID))
            {
                ShowInformation(GetString("srch.index.rebuildstarted"));
            }
            else
            {
                ShowError(GetString("index.nocontent"));
            }
        }
    }
Esempio n. 2
0
    public void RaisePostBackEvent(string eventArgument)
    {
        if (eventArgument == "saved")
        {
            // Check if document index has at least one culture specified
            if (!SearchIndexCultureInfoProvider.SearchIndexHasAnyCulture(indexId))
            {
                ShowError(GetString("index.noculture"));
                return;
            }

            // Check if there is at least one site assigned
            if (!SearchIndexSiteInfoProvider.SearchIndexHasAnySite(indexId))
            {
                ShowError(GetString("index.nosite"));
                return;
            }

            if (!SearchHelper.CreateRebuildTask(indexId))
            {
                ShowError(GetString("index.nocontent"));
                return;
            }

            ShowInformation(GetString("srch.index.rebuildstarted"));
        }
    }
Esempio n. 3
0
    /// <summary>
    /// Starts the search index rebuild task.
    /// </summary>
    private void Rebuild()
    {
        // Extra check for document index
        if ((SearchIndex.IndexType.Equals(TreeNode.OBJECT_TYPE, StringComparison.OrdinalIgnoreCase) || (SearchIndex.IndexType == SearchHelper.DOCUMENTS_CRAWLER_INDEX)))
        {
            // Check if there is at least one site assigned
            if (!SearchIndexSiteInfoProvider.SearchIndexHasAnySite(SearchIndex.IndexID))
            {
                ShowError(GetString("index.nosite"));
                return;
            }

            // Check if there is any culture assigned
            if (!SearchIndexCultureInfoProvider.SearchIndexHasAnyCulture(SearchIndex.IndexID))
            {
                ShowError(GetString("index.noculture"));
                return;
            }
        }

        if (!SearchHelper.CreateRebuildTask(SearchIndex.IndexID))
        {
            ShowError(GetString("index.nocontent"));
            return;
        }

        RaiseAsyncIndexTaskStarted();
        ShowInformation(GetString("srch.index.rebuildstarted"));
    }
    /// <summary>
    /// Handles click on rebuild link (after sites are saved).
    /// </summary>
    /// <param name="eventArgument">Event argument</param>
    public void RaisePostBackEvent(string eventArgument)
    {
        if (eventArgument == "saved")
        {
            // Check permissions
            if (!MembershipContext.AuthenticatedUser.IsAuthorizedPerResource("cms.searchindex", CMSAdminControl.PERMISSION_MODIFY))
            {
                RedirectToAccessDenied("cms.searchindex", CMSAdminControl.PERMISSION_MODIFY);
            }

            SearchIndexInfo sii = SearchIndexInfoProvider.GetSearchIndexInfo(indexId);
            if (sii.IndexType.Equals(CMS.DocumentEngine.TreeNode.OBJECT_TYPE, StringComparison.OrdinalIgnoreCase) || (sii.IndexType == SearchHelper.DOCUMENTS_CRAWLER_INDEX))
            {
                if (!SearchIndexCultureInfoProvider.SearchIndexHasAnyCulture(sii.IndexID))
                {
                    ShowError(GetString("index.noculture"));
                    return;
                }

                if (!SearchIndexSiteInfoProvider.SearchIndexHasAnySite(sii.IndexID))
                {
                    ShowError(GetString("index.nosite"));
                    return;
                }
            }

            if (SearchHelper.CreateRebuildTask(indexId))
            {
                ShowInformation(GetString("srch.index.rebuildstarted"));
            }
            else
            {
                ShowError(GetString("index.nocontent"));
            }
        }
    }