コード例 #1
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 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);
            }
        }
コード例 #2
0
 public void Run()
 {
     CrawlingLog.Log.Debug($"[Index={this.index.Name}] RemoteRebuildStrategy triggered.", null);
     IndexCustodian.FullRebuildRemote(this.index, true);
 }
コード例 #3
0
        public IJob FullRebuild(ISearchIndex index, bool isRemote)
        {
            var job = (isRemote) ? IndexCustodian.FullRebuildRemote(index) : IndexCustodian.FullRebuild(index);

            return(job == null ? null : new SpeJob(job));
        }