Sitecore 6.6 configuration update for sitecore 7 (using ComputedFields)

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

In our project, we used AdvancedDatabaseCrawler (ADC) for our indexes (especially because of its dynamic fields). Here is an example 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> 

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

Now we are updating our project to sitecore 7. In Sitecore 7, they ported DynamicFields functionality from ADC to sitecore. I learned some articles about this and converted our custom search field classes to implement the sitecore 7 IComputedIndexField instead of inheriting the BaseDynamicField class in the ADC. Now my problem is how to reconfigure the index to fit the new sitecore 7 APIs. There were bits and pieces on the Internet, but I could not find all the examples needed to convert my configuration. Can someone help me with this?

While I am doing this, I get the impression that we do not have to rebuild our indexes, since it still uses Lucene. I do not want to change the structure of the index. I just want to update the code and configuration from AdvancedDatabaseCrawler to Sitecore 7. Do I have to worry about breaking existing indexes? Please shed some light on this.

thanks

+6
source share
2 answers

I was able to convert the index configuration for the Sitecore ContentSearch API. Looking at the default configuration of Sitecore indexes, it was a big help for this.

Note: As mentioned by Stephen, <include hint="list:IncludeTemplate"> does not work in the original version of Sitecore 7.0. It is fixed in Sitecore 7.0 rev. 131127 (7.0 Update-3), and I plan to upgrade to it.

Here's a good article about the strategy for updating the sitecore 7 index from John West. This will help you customize your indexes the way you want.

Converted Configuration:

 <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> 
+4
source

A few quick clarifications :)

We did not integrate ADC into Sitecore 7, the ContentSearch layer is a complete overhaul of the old search layer for Sitecore. We took some basic concepts from the ADC, such as dynamic fields, and placed them in a new implementation (like ComputedFields). They are not 1: 1 compatible, and you will need to work a bit on your indexes.

The Lucene version has also been upgraded from 2. * to 3.0.3, so all indexes will need to be re-created anyway, since they are a completely different version of Lucene.

There are two options here: the old Lucene search (the Sitecore.Search namespace) (on which the ADC was built) was not affected and will work the same way, although I'm not sure if ADC is compatible with SItecore 7 as in theory, it has now been replaced.

The next option is to update your index to take advantage of the new Sitecore 7 search features. The configuration you use will not be directly compatible, but while you need to remake your index into a new configuration, the basic concepts should be familiar to you. The dynamic fields that you have should be logically mapped to ComputedFields (the fields that are computed when the element is indexed), and everything else is straightforward.

While ContentSearch looks like a lot of additional configuration, most of them are the default configuration, which you do not need to touch on, you just need to override the configuration parts for the computed fields that you want to add and the template that you want to include.

An example of creating your own configuration override can be found here: http://www.mikkelhm.dk/post/2013/10/12/Defining-a-custom-index-in-Sitecore-7-and-utilizing-it.aspx

I also recommend that you upgrade to 7.0 rev. 131127 (7.0 Update-3), as this fixes the error in the IncludeTemplates logic in the version that you currently have.

+7
source

All Articles