如何在嵌套的 Umbraco 内容上应用自定义检查搜索索引?

How to apply Custom Examine Search Index on Nested Umbraco Contents?

  1. 我有一个包含嵌套文档类型 Product 的文档类型 Home。我希望能够搜索产品。
    1. 我还在 ExamineIndex.config 中创建了一个检查索引集,如下所示:
 <IndexSet SetName="ProductsIndexSet" 
     IndexPath="~/App_Data/TEMP/ExamineIndexes/Products/" >
        <IndexAttributeFields>
          <add Name="id" />
          <add Name="nodeName"/>
          <add Name="productName"/>
          <add Name="nodeTypeAlias" />
        </IndexAttributeFields>
        <IncludeNodeTypes>    
          <add Name="homeProduct"/>
          <add Name="product"/>
        </IncludeNodeTypes>
      </IndexSet>
  1. 我在 ExamineSettings.config 中创建了检查索引器,如下所示:
  <add name="ProductIndexer" type="UmbracoExamine.UmbracoMemberIndexer, UmbracoExamine"
           supportUnpublished="true"
           supportProtected="true"
           analyzer="Lucene.Net.Analysis.Standard.StandardAnalyzer, Lucene.Net"
           indexSet="ProductsIndexSet"/>
  1. 我在 ExamineSettings.config 中创建了产品搜索器,如下所示:
   <add name="ProductSearcher"
               type="UmbracoExamine.UmbracoExamineSearcher, UmbracoExamine"
                supportUnpublished="false"
               supportProtected="true"
                indexSet="ProductsIndexSet"
                analyzer="Lucene.Net.Analysis.WhitespaceAnalyzer, Lucene.Net"/>

但是当 运行 来自 Developer- Examine Management- ProductIndexer 的重建索引时,我在索引中得到 0 个文档。

我真的不知道如何继续检查嵌套的内容。 谁能帮我在嵌套内容上设置检查搜索索引?

如果您的主节点别名是 "home",那么您需要将其添加到索引配置中的包含节点类型中。 product 不需要包含在内,除非它本身也是一个内容节点。

您可能还想看看这里的文章,其中概述了一种索引嵌套内容等的方法:

https://youritteam.com.au/blog/indexing-content-in-complex-umbraco-data-types