Sitefinity 搜索索引范围 - 添加 ihttphandler 任务

Sitefinity search index scope - add ihttphandler task

有没有办法可以将 ihttphandler 添加到搜索索引范围。我有一个收集外部数据然后执行 updateIndex 的 ihttphandler processrequest。但是我想看看当重新索引任务完成时是否可以触发它。

 public class ExternalIndexerHandler : IHttpHandler

所以我认为您想 运行 ToPublishingPoint 方法上的自定义代码,当它正确完成时?

Global.asax

            PublishingSystemFactory.UnregisterPipe(PageInboundPipe.PipeName);
            PublishingSystemFactory.RegisterPipe(PageInboundPipeCustom.PipeName, typeof(PageInboundPipeCustom));

现在管道...

    public class PageInboundPipeCustom : PageInboundPipe
    {
        public override void ToPublishingPoint()
        {
            //Index has completed, time to do whatever now...
            base.ToPublishingPoint();

            var itemsToAdd = new List<WrapperObject>();

            //Make sure its only running for a specific index
            if (this.PipeSettings.PublishingPoint.Name == "YourIndexName")
            {
                var externalStuff = this.GetExternalStuff();
                foreach (var s in externalStuff )
                {
                    var item = new AppendixIndexItem(s);
                    var itemToAdd = new WrapperObject(item);

                    Debug.WriteLine(item.IdentityField);

                    //Metadata... if needed
                    //itemToAdd.SetOrAddProperty("Tags", "Educational Material");
                    itemsToAdd.Add(itemToAdd);
                }

                if (itemsToAdd.Count > 0)
                {
                    this.PublishingPoint.AddItems(itemsToAdd);
                }
            }
        }

        public List<string> GetExternalStuff() {
           var items = new List<string>();
           
           //Callback to your external stuff?

           return items;
        }
    }

这就是你要找的吗?

Steve McNiven-Scott