private void RebuildIndex(ISearchIndex index, bool isRemoteIndex = false)
        {
            if (IndexCustodian.IsRebuilding(index))
            {
                WriteVerbose($"Skipping full index rebuild for {index.Name} because it's already running.");
                var job = Sitecore.Jobs.JobManager.GetJob($"{"Index_Update"}_IndexName={index.Name}");

                if (job == null || !AsJob)
                {
                    return;
                }

                WriteVerbose($"Background job existed: {job.Name}");
                WriteObject(job);
            }
            else
            {
                WriteVerbose($"Starting full index rebuild for {index.Name}.");
                var job = (isRemoteIndex) ? IndexCustodian.FullRebuildRemote(index) : IndexCustodian.FullRebuild(index);

                if (job == null || !AsJob)
                {
                    return;
                }

                WriteVerbose($"Background job created: {job.Name}");
                WriteObject(job);
            }
        }
Ejemplo n.º 2
0
        private void RebuildIndex(ISearchIndex index, bool isRemoteIndex = false)
        {
            if (IndexCustodian.IsRebuilding(index))
            {
                WriteVerbose($"Skipping full index rebuild for {index.Name} because it's already running.");
                var jobManager = TypeResolver.ResolveFromCache <IJobManager>();
                var job        = jobManager.GetJob($"Index_Update_IndexName={index.Name}");

                if (job == null || !AsJob)
                {
                    return;
                }

                WriteVerbose($"Background job existed: {job.Name}");
                WriteObject(job);
            }
            else
            {
                WriteVerbose($"Starting full index rebuild for {index.Name}.");
                var indexManager = TypeResolver.ResolveFromCache <IIndexManager>();
                var job          = indexManager.FullRebuild(index, isRemoteIndex);

                if (job == null || !AsJob)
                {
                    return;
                }

                WriteVerbose($"Background job created: {job.Name}");
                WriteObject(job);
            }
        }
        public override IEnumerable <TestingSearchResultItem> GetActiveTests(DataUri hostItemDataUri = null, string searchText = null, ID deviceId = null)
        {
            TestingSearch testingSearch      = new TestingSearch();
            ISearchIndex  testingSearchIndex = Sitecore.ContentTesting.ContentSearch.TestingSearch.GetTestingSearchIndex();

            if (testingSearchIndex == null)
            {
                return(Enumerable.Empty <TestingSearchResultItem>());
            }
            int num = 0;

            while (IndexCustodian.IsRebuilding(testingSearchIndex) && num < 10)
            {
                Thread.Sleep(200);
                num++;
            }
            if (hostItemDataUri != null)
            {
                testingSearch.HostItem = hostItemDataUri;
            }
            if (!string.IsNullOrEmpty(searchText))
            {
                testingSearch.SearchText = searchText;
            }
            if (deviceId != (ID)null)
            {
                testingSearch.DeviceId = deviceId;
            }
            return(testingSearch.GetRunningTests());
        }
Ejemplo n.º 4
0
        void HandleTweet(ITweet tweet)
        {
            if ((from tag in tweet.Hashtags where tag.Text == HashtagTrigger select tag).Any())
            {
                Log.Info("Index rebuild triggered from Twitter by '{0}'".FormatWith(tweet.Creator.Name), this);
                CrawlingLog.Log.Info("Index rebuild triggered from Twitter by '{0}'".FormatWith(tweet.Creator.Name));

                if (IndexCustodian.IsIndexingPaused(m_index) || IndexCustodian.IsRebuilding(m_index))
                {
                    CrawlingLog.Log.Warn("Indexing call muted");
                    Log.Info("Indexing call muted", this);
                    return;
                }

                IndexCustodian.FullRebuild(m_index);
            }
        }