Indexing 将sitecore 6.6索引配置升级到sitecore 7(使用计算字段)
Sitecore CMS+DMS 6.6.0版本130404=>7.0版本130424 在我们的项目中,我们一直使用AdvancedDatabaseCrawler(ADC)作为索引(特别是因为它的动态字段特性)。下面是一个索引配置示例:Indexing 将sitecore 6.6索引配置升级到sitecore 7(使用计算字段),indexing,sitecore,lucene.net,sitecore6,sitecore7,Indexing,Sitecore,Lucene.net,Sitecore6,Sitecore7,Sitecore CMS+DMS 6.6.0版本130404=>7.0版本130424 在我们的项目中,我们一直使用AdvancedDatabaseCrawler(ADC)作为索引(特别是因为它的动态字段特性)。下面是一个索引配置示例: <index id="GeoIndex" type="Sitecore.Search.Index, Sitecore.Kernel"> <param desc="name">$(id)</param> <param de
<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>
<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>
$(id)
$(id)
网状物
/sitecore/内容/全局/位置
真的
{FF0D64AA-DCB4-467A-A310-FF905F93C0}
如您所见,我们使用scSearchContrib.Crawler.Crawlers.AdvancedDatabaseCrawler
作为爬虫程序,它使用
部分中定义的字段将自定义字段注入索引
现在我们正在将我们的项目升级到sitecore 7。在Sitecore 7中,他们将DynamicFields功能从ADC移植到Sitecore中。我找到了一些关于这方面的文章,并将我们的自定义搜索字段类转换为实现sitecore 7IComputedIndexField
接口,而不是从ADC中的BaseDynamicField
类继承。现在我的问题是如何更改索引配置以匹配新的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
它看起来有很多额外的配置,但很多都是默认配置,您不需要触摸,您只需要覆盖要添加的计算字段和要包含的模板的配置部分
您可以在此处找到创建自己的配置覆盖的示例:
我还建议您确保升级到7.0版本。131127(7.0 Update-3),因为这修复了当前版本中IncludeTemplates逻辑中的错误。我成功地转换了sitecore ContentSearch API的索引配置。查看Sitecore默认索引配置对此有很大帮助 注意:正如Stephen提到的,
在Sitecore 7.0初始版本中不起作用。它已在Sitecore 7.0版本中修复。131127(7.0更新-3),我计划升级到它
这里有一篇关于约翰·韦斯特的好文章。它将帮助您以您想要的方式配置索引
转换的配置:
<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>
<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>
真的
{FF0D64AA-DCB4-467A-A310-FF905F93C0}
OurApp.CustomSearchFields.SearchTextField,OurApp
OurApp.CustomSearchFields.LongNameField,OurApp
$(id)
$(id)
网状物
/sitecore/内容/全球/国家/地区
非常感谢Stephen!通过查看sitecore附带的sitecore搜索配置和一些实验,我成功地转换了配置。是的,IncludeTemplates坏了,我要升级到7.0 Update-3。