【问题标题】:Umbraco - Examine index not updatedUmbraco - 检查索引未更新
【发布时间】:2011-06-15 01:23:48
【问题描述】:

我正在使用 Umbraco CMS,并尝试使用其使用 Examine 的站点搜索功能。

当我编辑一个页面并发布它时,检查索引没有更新,因此搜索结果总是过时的。我必须手动删除 Index 文件夹才能更新它。

不应该每次更新内容时自动更新索引吗?

【问题讨论】:

    标签: search umbraco


    【解决方案1】:

    我编写了一个更新发布时索引的类。

    using umbraco.BusinessLogic;
    using umbraco.cms.businesslogic.web;
    using Examine;
    
    public class UmbracoEvents: ApplicationBase
    {
      /// <summary>Constructor</summary>
      public UmbracoEvents()
      {
        Document.AfterPublish += new Document.PublishEventHandler(Document_AfterPublish);
      }
    
      private void Document_AfterPublish(Document sender, umbraco.cms.businesslogic.PublishEventArgs e)
      {
        // Rebuild SiteSearchIndexer
        ExamineManager.Instance.IndexProviderCollection["SiteSearchIndexer"].RebuildIndex(); // Unfortunately this doesn't index the latest change, must republish to index it
      }
    }
    

    但是,即使它应该在“发布后”运行,它也不会获得最新的更改。因此,要使搜索结果保持最新,您必须发布两次:S

    【讨论】:

      【解决方案2】:

      您可以使用Examine Dashboard 手动更新索引。

      要在应用启动时自动重建索引,您可以将此行添加到位于配置目录中的ExamineIndex.config

      <Examine RebuildOnAppStart="true">
      

      当您发布/重新发布内容节点时,索引应该会自动重建。如果它不起作用,则可能是检查的配置问题。

      【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多