如何使用Sitecore Search将字段从索引中排除(新方法) [英] How to exclude fields form being indexed with Sitecore search (new method)

查看:16
本文介绍了如何使用Sitecore Search将字段从索引中排除(新方法)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用Sitecore(新方法)指定要使用Lucene索引编制索引的字段?

例如,我只想为字段"title"和"text"编制索引。似乎有一个IndexAllField参数可以设置为False,但是我如何设置需要索引哪些字段?

我正在使用Sitecore.Search.Crawlers.DatabaseCrawler。

推荐答案

您使用的是Advanced Database Crawler吗?如果是这样的话,您可以添加一些部分,以便通过GUID包括特定字段,并通过GUID排除特定字段。下面我提供了一个代码片段,其中<include>节点的hint属性定义了应该包括还是排除字段

<master type="Sitecore.SharedSource.Search.Crawlers.AdvancedDatabaseCrawler,Sitecore.SharedSource.Search">
  <Database>master</Database>
  <Root>/sitecore/content</Root>
  <IndexAllFields>false</IndexAllFields>

  <include hint="list:IncludeField">
    <!-- some field you'd want to include -->
    <fieldId>{8CDC337E-A112-42FB-BBB4-4143751E123F}</fieldId>
  </include>

  <include hint="list:ExcludeField">
    <!-- __revision field -->
    <fieldId>{8CDC337E-A112-42FB-BBB4-4143751E123F}</fieldId>
    <!-- __context menu field -->
    <fieldId>{D3AE7222-425D-4B77-95D8-EE33AC2B6730}</fieldId>
    <!-- __security field -->
    <fieldId>{DEC8D2D5-E3CF-48B6-A653-8E69E2716641}</fieldId>
    <!-- __renderings field -->
    <fieldId>{F1A1FE9E-A60C-4DDB-A3A0-BB5B29FE732E}</fieldId>
  </include>

您可以在SVN上看到a sample search config for the Advanced Database Crawler

这篇关于如何使用Sitecore Search将字段从索引中排除(新方法)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆