将sitecore 6.6索引配置升级到sitecore 7(使用ComputedFields) [英] Upgrading sitecore 6.6 index configuration to sitecore 7 (using ComputedFields)

查看:174
本文介绍了将sitecore 6.6索引配置升级到sitecore 7(使用ComputedFields)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

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

In our project we have been using AdvancedDatabaseCrawler (ADC) for our indexes (specially because of it's dynamic fields feature). Here's a sample index configuration:

<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> 部分中定义的字段将自定义字段注入索引。

As you can see, we use scSearchContrib.Crawler.Crawlers.AdvancedDatabaseCrawler as the crawler and it uses the fields defined inside <dynamicFields hint="raw:AddDynamicFields"> section to inject custom fields into the index.

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

Now we are upgrading our project to sitecore 7. In Sitecore 7, they have ported the DynamicFields functionality from ADC into sitecore. I found out some articles on this and converted our custom search field classes to implement sitecore 7 IComputedIndexField interface instead of inheriting from BaseDynamicField class in ADC. Now my problem is how to change the index configuration to match with new sitecore 7 APIs. There were bits and pieces on the web but couldn't find all the examples I needed to convert my configuration. Can anybody help me on this?

虽然我这样做但我觉得我们不必重建我们的索引,因为它仍然在内部使用Lucene 。我不想改变索引结构。只想将代码和配置从AdvancedDatabaseCrawler升级到Sitecore 7.我是否应该担心破坏现有的索引?请详细说明。

While I'm doing this I'm under the impression that we won't have to rebuild our indexes since it still uses Lucene internally. I don't want to change the index structure. Just want to upgrade the code and configuration from AdvancedDatabaseCrawler to Sitecore 7. Should I be worried about breaking our existing indexes? Please shed some light on this as well.

谢谢

推荐答案

我设法转换了sitecore ContentSearch API的索引配置。查看Sitecore默认索引配置对此非常有帮助。

I managed to convert the index configuration for sitecore ContentSearch API. Looking at Sitecore default index configurations was a great help for this.

注意:正如Stephen所提到的,< ; include hint =list:IncludeTemplate> 在Sitecore 7.0初始版本中不起作用。它已在Sitecore 7.0 rev中修复。 131127(7.0更新-3),我打算升级到它。

Note: As also mentioned by Stephen, <include hint="list:IncludeTemplate"> does not work in Sitecore 7.0 initial release. It's fixed in Sitecore 7.0 rev. 131127 (7.0 Update-3) and I'm planning to upgrade to it.

这是关于 sitecore 7索引更新策略 by约翰韦斯特。它会帮助您按照自己的方式配置索引。

Here's a good article on sitecore 7 index update strategies by John West. It'll help you in configuration your indexes the way you want.

转换配置:

<sitecore>
<contentSearch>
  <configuration type="Sitecore.ContentSearch.LuceneProvider.LuceneSearchConfiguration, Sitecore.ContentSearch.LuceneProvider">
    <DefaultIndexConfiguration type="Sitecore.ContentSearch.LuceneProvider.LuceneIndexConfiguration, Sitecore.ContentSearch.LuceneProvider">
      <IndexAllFields>true</IndexAllFields>
      <include hint="list:IncludeTemplate">
        <!--Suburb Template-->
        <suburb>{FF0D64AA-DCB4-467A-A310-FF905F9393C0}</suburb>
      </include>
      <fields hint="raw:AddComputedIndexField">
        <field fieldName="search text" storageType="NO" indexType="TOKENIZED" vectorType="NO">OurApp.CustomSearchFields.SearchTextField,OurApp</field>
        <field fieldName="display name" storageType="YES" indexType="UN_TOKENIZED" vectorType="NO">OurApp.CustomSearchFields.LongNameField,OurApp</field>
      </fields>
    </DefaultIndexConfiguration>
    <indexes hint="list:AddIndex">
      <index id="GeoIndex" type="Sitecore.ContentSearch.LuceneProvider.LuceneIndex, Sitecore.ContentSearch.LuceneProvider">
        <param desc="name">$(id)</param>
        <param desc="folder">$(id)</param>
        <!-- This initializes index property store. Id has to be set to the index id -->
        <param desc="propertyStore" ref="contentSearch/databasePropertyStore" param1="$(id)" />
        <strategies hint="list:AddStrategy">
          <!-- NOTE: order of these is controls the execution order -->
          <strategy ref="contentSearch/indexUpdateStrategies/onPublishEndAsync" />
        </strategies>
        <commitPolicy hint="raw:SetCommitPolicy">
          <policy type="Sitecore.ContentSearch.TimeIntervalCommitPolicy, Sitecore.ContentSearch" />
        </commitPolicy>
        <commitPolicyExecutor hint="raw:SetCommitPolicyExecutor">
          <policyExecutor type="Sitecore.ContentSearch.CommitPolicyExecutor, Sitecore.ContentSearch" />
        </commitPolicyExecutor>
        <locations hint="list:AddCrawler">
          <crawler type="Sitecore.ContentSearch.LuceneProvider.Crawlers.DefaultCrawler, Sitecore.ContentSearch.LuceneProvider">
            <Database>web</Database>
            <Root>/sitecore/content/Globals/Countries</Root>
          </crawler>
        </locations>
      </index>
    </indexes>
  </configuration>
</contentSearch>
</sitecore>

这篇关于将sitecore 6.6索引配置升级到sitecore 7(使用ComputedFields)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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