indexing - 将 sitecore 6.6 索引配置升级到 sitecore 7(使用 ComputedFields)

标签 indexing sitecore lucene.net sitecore6 sitecore7

Sitecore CMS+DMS 6.6.0 rev.130404 => 7.0 rev.130424

在我们的项目中,我们一直使用 AdvancedDatabaseCrawler (ADC) 作为我们的索引(特别是因为它的动态字段功能)。这是一个示例索引配置:

<index id="GeoIndex" type="Sitecore.Search.Index, Sitecore.Kernel">
<param desc="name">$(id)</param>
<param desc="folder">$(id)</param>
<analyzer ref="search/analyzer" />
<locations hint="list:AddCrawler">
  <web type="scSearchContrib.Crawler.Crawlers.AdvancedDatabaseCrawler, scSearchContrib.Crawler">
    <database>web</database>
    <root>/sitecore/content/Globals/Locations</root>
    <IndexAllFields>true</IndexAllFields>
    <include hint="list:IncludeTemplate">
      <!--Suburb Template-->
      <suburb>{FF0D64AA-DCB4-467A-A310-FF905F9393C0}</suburb>
    </include>
    <dynamicFields hint="raw:AddDynamicFields">
      <dynamicField type="OurApp.CustomSearchFields.SearchTextField,OurApp" name="search text" storageType="NO" indexType="TOKENIZED" vectorType="NO" />
      <dynamicField type="OurApp.CustomSearchFields.LongNameField,OurApp" name="display name" storageType="YES" indexType="UN_TOKENIZED" vectorType="NO" />
    </dynamicFields>
  </web>
</locations>
</index>

如您所见,我们使用 scSearchContrib.Crawler.Crawlers.AdvancedDatabaseCrawler作为爬虫,它使用 <dynamicFields hint="raw:AddDynamicFields"> 中定义的字段部分将自定义字段注入(inject)索引。

现在我们正在将我们的项目升级到 sitecore 7。在 Sitecore 7 中,他们将 DynamicFields 功能从 ADC 移植到了 sitecore。我发现了一些关于此的文章,并将我们的自定义搜索字段类转换为实现 sitecore 7 IComputedIndexField接口(interface)而不是从 BaseDynamicField 继承ADC中的类。现在我的问题是如何更改索引配置以匹配新的 sitecore 7 API。网上有一些零碎的东西,但找不到转换配置所需的所有示例。有人可以帮我吗?

当我这样做时,我的印象是我们不必重建我们的索引,因为它仍然在内部使用 Lucene。我不想更改索引结构。只想将代码和配置从 AdvancedDatabaseCrawler 升级到 Sitecore 7。我应该担心破坏我们现有的索引吗?请对此也有所了解。

谢谢

最佳答案

一些快速的澄清:)

我们尚未将 ADC 合并到 Sitecore 7 中,即 ContentSearch层是对 Sitecore 旧搜索层的完全重写。我们从 ADC 中提取了一些核心概念,例如动态字段,并将它们放入新的实现中(如 ComputedFields)。它们不是 1:1 兼容的,您必须在索引上做一些工作。

Lucene 的版本也已从 2.* 升级到 3.0.3,因此无论如何都需要重新创建所有索引,因为它们是 Lucene 的一个非常不同的版本。

这里有两个选项,旧的 Lucene 搜索(Sitecore.Search 命名空间)(ADC 是基于它构建的)没有被触及,并且仍然可以以相同的方式工作,尽管我不确定 ADC 与 Sitecore 7 的兼容性是否在理论上现在已被取代。

下一个选项是更新您的索引以利用 Sitecore 7 的新搜索功能。您拥有的配置不会直接兼容,但是,虽然您需要将您的索引重新设计为新配置,但您应该熟悉基本概念给你。您拥有的动态字段应该在逻辑上映射到 ComputedFields(索引项目时计算的字段),其他一切都很简单。

虽然 ContentSearch 看起来有很多额外的配置其中很多是您不需要触摸的默认配置,您只需要覆盖要添加的计算字段和要包含的模板的配置部分。

可以在此处找到创建自己的配置覆盖的示例:http://www.mikkelhm.dk/post/2013/10/12/Defining-a-custom-index-in-Sitecore-7-and-utilizing-it.aspx

我还建议您确保升级到 7.0 rev。 131127 (7.0 Update-3) 因为这修复了您当前拥有的版本中 IncludeTemplates 逻辑中的错误。

关于indexing - 将 sitecore 6.6 索引配置升级到 sitecore 7(使用 ComputedFields),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20695785/

相关文章:

c# - Sitecore 7 搜索索引问题

c# - Lucene - 将多字段查询与 boolean 查询相结合

python - 如何计算具有由索引数组定义的不同窗口大小的 NumPy 数组的移动平均值?

用于搜索和索引的 C++ 框架,如 clucene

MySQL警告: primary key and index on the same field in MYSQL

web-config - 跨多个站点/域的 Sitecore 6.5 url(不解析站点?)

sitecore 查询以在多列表中为选定的父级选择子级

mysql - mysql索引如何将随机I/O变成顺序I/O

sitecore - 如何在 Sitecore 7 ContentSearch API 中执行多个术语的搜索?

c# - Lucene 搜索日文字符