/// -----------------------------------------------------------------------------
        /// <summary>
        /// DoWork runs the scheduled item
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        ///		[cnurse]	11/15/2004	documented
        ///     [vqnguyen]  05/28/2013  updated
        /// </history>
        /// -----------------------------------------------------------------------------
        public override void DoWork()
        {
            try
            {
                var searchEngine = new SearchEngine();
                var lastSuccessFulDateTime = SearchHelper.Instance.GetLastSuccessfulIndexingDateTime(ScheduleHistoryItem.ScheduleID);
                Logger.Trace("Search: Site Crawler - Starting. Content change start time " + lastSuccessFulDateTime.ToString("g"));
                ScheduleHistoryItem.AddLogNote(string.Format("Starting. Content change start time <b>{0:g}</b>", lastSuccessFulDateTime));

                searchEngine.DeleteOldDocsBeforeReindex(lastSuccessFulDateTime);
                searchEngine.IndexContent(lastSuccessFulDateTime);
                foreach (var result in searchEngine.Results)
                {
                    ScheduleHistoryItem.AddLogNote("<br/>&nbsp&nbsp " + result.Key + " Indexed: " + result.Value);
                }
                ScheduleHistoryItem.AddLogNote("<br/><b>Total Items Indexed: " + searchEngine.IndexedSearchDocumentCount + "</b>");

                searchEngine.CompactSearchIndexIfNeeded(ScheduleHistoryItem);
                ScheduleHistoryItem.Succeeded = true;
                ScheduleHistoryItem.AddLogNote("<br/><b>Indexing Successful</b>");
                SearchHelper.Instance.SetLastSuccessfulIndexingDateTime(ScheduleHistoryItem.ScheduleID, ScheduleHistoryItem.StartDate);

                Logger.Trace("Search: Site Crawler - Indexing Successful");
            }
            catch (Exception ex)
            {
                ScheduleHistoryItem.Succeeded = false;
                ScheduleHistoryItem.AddLogNote("<br/>EXCEPTION: " + ex.Message);
                Errored(ref ex);
                if (ScheduleHistoryItem.ScheduleSource != ScheduleSource.STARTED_FROM_BEGIN_REQUEST)
                {
                    Exceptions.Exceptions.LogException(ex);
                }
            }
        }
示例#2
0
 /// -----------------------------------------------------------------------------
 /// <summary>
 /// DoWork runs the scheduled item
 /// </summary>
 /// <remarks>
 /// </remarks>
 /// <history>
 ///		[cnurse]	11/15/2004	documented
 /// </history>
 /// -----------------------------------------------------------------------------
 public override void DoWork()
 {
     try
     {
         var se = new SearchEngine();
         se.IndexContent();
         ScheduleHistoryItem.Succeeded = true;
         ScheduleHistoryItem.AddLogNote("Completed re-indexing content");
     }
     catch (Exception ex)
     {
         ScheduleHistoryItem.Succeeded = false;
         ScheduleHistoryItem.AddLogNote("EXCEPTION: " + ex.Message);
         Errored(ref ex);
         Exceptions.Exceptions.LogException(ex);
     }
 }
示例#3
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// DoWork runs the scheduled item.
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// -----------------------------------------------------------------------------
        public override void DoWork()
        {
            try
            {
                var lastSuccessFulDateTime = SearchHelper.Instance.GetLastSuccessfulIndexingDateTime(this.ScheduleHistoryItem.ScheduleID);
                Logger.Trace("Search: Site Crawler - Starting. Content change start time " + lastSuccessFulDateTime.ToString("g"));
                this.ScheduleHistoryItem.AddLogNote(string.Format("Starting. Content change start time <b>{0:g}</b>", lastSuccessFulDateTime));

                var searchEngine = new SearchEngine(this.ScheduleHistoryItem, lastSuccessFulDateTime);
                try
                {
                    searchEngine.DeleteOldDocsBeforeReindex();
                    searchEngine.DeleteRemovedObjects();
                    searchEngine.IndexContent();
                    searchEngine.CompactSearchIndexIfNeeded(this.ScheduleHistoryItem);
                }
                finally
                {
                    searchEngine.Commit();
                }

                this.ScheduleHistoryItem.Succeeded = true;
                this.ScheduleHistoryItem.AddLogNote("<br/><b>Indexing Successful</b>");
                SearchHelper.Instance.SetLastSuccessfulIndexingDateTime(this.ScheduleHistoryItem.ScheduleID, this.ScheduleHistoryItem.StartDate);

                Logger.Trace("Search: Site Crawler - Indexing Successful");
            }
            catch (Exception ex)
            {
                this.ScheduleHistoryItem.Succeeded = false;
                this.ScheduleHistoryItem.AddLogNote("<br/>EXCEPTION: " + ex.Message);
                this.Errored(ref ex);
                if (this.ScheduleHistoryItem.ScheduleSource != ScheduleSource.STARTED_FROM_BEGIN_REQUEST)
                {
                    Exceptions.Exceptions.LogException(ex);
                }
            }
        }
示例#4
0
 /// -----------------------------------------------------------------------------
 /// <summary>
 /// cmdReIndex_Click runs when the ReIndex LinkButton is clicked.  It re-indexes the
 /// site (or application if run on Host page)
 /// </summary>
 /// <remarks>
 /// </remarks>
 /// <history>
 /// 	[cnurse]	11/16/2004 created
 /// </history>
 /// -----------------------------------------------------------------------------
 protected void OnReIndexClick(object sender, EventArgs e)
 {
     try
     {
         Page.Validate();
         if (Page.IsValid)
         {
             var se = new SearchEngine();
             if (Globals.IsHostTab(ModuleContext.PortalSettings.ActiveTab.TabID))
             {
                 se.IndexContent();
             }
             else
             {
                 se.IndexContent(ModuleContext.PortalId);
             }
             UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("Indexed", LocalResourceFile), ModuleMessage.ModuleMessageType.GreenSuccess);
         }
     }
     catch (Exception exc) //Module failed to load
     {
         Exceptions.ProcessModuleLoadException(this, exc);
     }
 }
 /// <summary>
 /// cmdReIndex_Click runs when the ReIndex LinkButton is clicked.  It re-indexes the
 /// site (or application if run on Host page)
 /// </summary>
 /// <remarks>
 /// </remarks>
 /// <history>
 /// 	[cnurse]	11/16/2004 created
 /// </history>
 protected void cmdReIndex_Click( object sender, EventArgs e )
 {
     try
     {
         SearchEngine se = new SearchEngine();
         if( PortalSettings.ActiveTab.ParentId == PortalSettings.SuperTabId )
         {
             se.IndexContent();
         }
         else
         {
             se.IndexContent( PortalId );
         }
     }
     catch( Exception exc ) //Module failed to load
     {
         Exceptions.ProcessModuleLoadException( this, exc );
     }
 }