Reputation: 1459
Currently, I have lucene search engine in my sitecore 8 instance. It is working perfectly but something change in our production servers. The production servers now are 2 content delivery server with load balancing and a content management server.
I read that it is difficult to use lucene in this kind of architecture. They are suggesting to use Solr instead of lucene.
I am able to setup solr with the help of this post. It is working perfectly and I able to create indexes for sitecore_web_index, sitecore_master_index, sitecore_core_index and sitecore_analytics_index.
What I am having trouble is converting my custom search index configuration to SOLR configuration (schema.xml).
My search index configuration contains computed fields and an include template (<include hint="list:IncludeTemplate">
) that index only those specific fields.
Question:
<include hint="list:IncludeTemplate"> <page>{GUID}</page> </include>
I already checked the samples in solrTutorial.com but can't find what I am looking for (Noob!).
Looking forward to learn from you guys.
UPDATE:
Implementing the suggestion of nsgocev I received the error below:
Update 2:
Looks like setting the Initialize on Add to true cause the problem:
<initializeOnAdd>true</initializeOnAdd>
Please let me know what I am missing.
Thanks,
Upvotes: 0
Views: 792
Reputation: 4470
Basically using computed fields is the same like using it with your Lucene indexes. The idea is to add your fields in your Sitecore.ContentSearch.Solr.*
configurations instead in your Sitecore.ContentSearch.Lucene.*
configurations. In the Solr configs (Most likely the Sitecore.ContentSearch.Solr.DefaultIndexConfiguration.config
) there should be <fields hint="raw:AddComputedIndexField">
section where you just need to add your computed field like this:
<fields hint="raw:AddComputedIndexField">
...
<field fieldName="mycomputedfield" returnType="string">YourNamespace.MyComputedField, YourAssembly</field>
</fields>
Same goes for indexing on a particular template. There is a list in the same configuration file (commented out by default)
<!-- <include hint="list:IncludeTemplate">
<BucketFolderTemplateId>{ADB6CA4F-03EF-4F47-B9AC-9CE2BA53FF97}</BucketFolderTemplateId>
</include>-->
Upvotes: 3