예제 #1
0
        private static void RunTaskOnNewThread(object oTask)
        {
            if (oTask == null)
            {
                return;
            }
            IndexWriterTask task = oTask as IndexWriterTask;

            log.Info("deserialized IndexWriterTask task");

            // give a little time to make sure the taskqueue was updated after spawning the thread
            Thread.Sleep(100); // 0.10 seconds

            task.RunTask();

            log.Info("started IndexWriterTask task");
        }
예제 #2
0
        public static void QueueIndexing()
        {
            if (WebConfigSettings.DisableSearchIndex) { return; }

            if (!WebConfigSettings.IsSearchIndexingNode) { return;}

            if (IndexWriterTask.IsRunning()) { return; }

            IndexWriterTask indexWriter = new IndexWriterTask();

            indexWriter.StoreContentForResultsHighlighting = WebConfigSettings.EnableSearchResultsHighlighting;

            // Commented out 2009-01-24
            // seems to cause errors for some languages if we localize this
            // perhaps because the background thread is not running on the same culture as the
            // web ui which is driven by browser language preferecne.
            // if we do localize it we should localize to the site default culture, not the user's
            //indexWriter.TaskName = Resource.IndexWriterTaskName;
            //indexWriter.StatusCompleteMessage = Resource.IndexWriterTaskCompleteMessage;
            //indexWriter.StatusQueuedMessage = Resource.IndexWriterTaskQueuedMessage;
            //indexWriter.StatusStartedMessage = Resource.IndexWriterTaskStartedMessage;
            //indexWriter.StatusRunningMessage = Resource.IndexWriterTaskRunningFormatString;

            indexWriter.QueueTask();

            WebTaskManager.StartOrResumeTasks();
        }