public void Rebuild()
 {
     using (IndexUpdateContext context = this.CreateUpdateContext())
     {
         foreach (IRamCrawler crawler in this._crawlers)
         {
             crawler.Add(context);
         }
         context.Optimize();
         context.Commit();
     }
 }
Пример #2
0
 public void AddItem(Item item)
 {
     Assert.ArgumentNotNull(item, "item");
     if (this.IsMatch(item))
     {
         using (IndexUpdateContext context = this._index.CreateUpdateContext())
         {
             this.AddItem(item, context);
             context.Commit();
         }
     }
 }
Пример #3
0
 public void AddVersion(Item version)
 {
     Assert.ArgumentNotNull(version, "version");
     if (this.IsMatch(version))
     {
         using (IndexUpdateContext context = this._index.CreateUpdateContext())
         {
             this.AddVersion(version, context);
             context.Commit();
         }
     }
 }
Пример #4
0
 public void AddTree(Item root)
 {
     Assert.ArgumentNotNull(root, "root");
     if (root.Axes.IsDescendantOf(this._root))
     {
         using (IndexUpdateContext context = this._index.CreateUpdateContext())
         {
             this.AddTree(root, context);
             context.Commit();
         }
     }
 }
Пример #5
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;
                }
            }
Пример #7
0
        public override void Optimize()
        {
            this.CloseSearcher();

            using (IndexUpdateContext context = _index.CreateUpdateContext())
            {
                Type indexUpdateContextType = typeof(IndexUpdateContext);

                IndexWriter writer = indexUpdateContextType.InvokeMember("_writer",
                                                                         BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.GetField,
                                                                         null,
                                                                         context,
                                                                         null) as IndexWriter;

                if (writer != null)
                {
                    writer.Optimize();
                }

                context.Commit();
            }
        }
            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;
                }
            }