public void Rebuild()
 {
     using (IndexUpdateContext context = this.CreateUpdateContext())
     {
         foreach (IRamCrawler crawler in this._crawlers)
         {
             crawler.Add(context);
         }
         context.Optimize();
         context.Commit();
     }
 }
Esempio n. 2
0
        public void Rebuild()
        {
            using (IndexUpdateContext context = this.CreateUpdateContext())
            {
                foreach (IRemoteCrawler crawler in this._crawlers)
                {
                    crawler.Add(context);
                }
                context.Optimize();
                context.Commit();
            }

            File.Copy((Path.Combine(Config.RemoteIndexingServer, _folder)), Settings.IndexFolder);
        }
            protected void RemoteBuild()
            {
                var job = Context.Job;

                if (job != null)
                {
                    try
                    {
                        var serverAddress = Util.Config.RemoteIndexingServer;
                        //Copy PsExec to Target Address

                        foreach (var str in this.indexNames)
                        {
                            var index = SearchManager.GetIndex(str);
                            if (index != null)
                            {
                                using (IndexUpdateContext context = new IndexUpdateContext(index))
                                {
                                    foreach (ICrawler crawler in SearchManager.Indexes.Where(indexType => indexType.GetType() == Type.GetType("Sitecore.ItemBuckets.BigData.RemoteIndex.RemoteIndex, Sitecore.ItemBuckets.BigData")))
                                    {
                                        crawler.Add(context);
                                    }
                                    context.Optimize();
                                    context.Commit();
                                }
                            }

                            var status = job.Status;
                            status.Processed += 1L;
                        }
                    }
                    catch (Exception exception)
                    {
                        job.Status.Failed = true;
                        job.Status.Messages.Add(exception.ToString());
                    }

                    job.Status.State = JobState.Finished;
                }
            }
            protected void RemoteBuild()
            {
                var job = Context.Job;
                if (job != null)
                {
                    try
                    {
                        var serverAddress = Util.Config.RemoteIndexingServer;
                        //Copy PsExec to Target Address

                        foreach (var str in this.indexNames)
                        {
                            var index = SearchManager.GetIndex(str);
                            if (index != null)
                            {

                                using (IndexUpdateContext context = new IndexUpdateContext(index))
                                {
                                    foreach (ICrawler crawler in SearchHelper.GetIndexes().Where(indexType => indexType.GetType() == Type.GetType("Sitecore.ItemBuckets.BigData.RemoteIndex.RemoteIndex, Sitecore.ItemBuckets.BigData")))
                                    {
                                        crawler.Add(context);
                                    }
                                    context.Optimize();
                                    context.Commit();
                                }

                            }

                            var status = job.Status;
                            status.Processed += 1L;
                        }
                    }
                    catch (Exception exception)
                    {
                        job.Status.Failed = true;
                        job.Status.Messages.Add(exception.ToString());
                    }

                    job.Status.State = JobState.Finished;
                }
            }