Skip to content

Instantly share code, notes, and snippets.

@vince-geekcore
Last active February 24, 2016 21:17
Show Gist options
  • Save vince-geekcore/b978fb5019be9b81680d to your computer and use it in GitHub Desktop.
Save vince-geekcore/b978fb5019be9b81680d to your computer and use it in GitHub Desktop.
Sitecore 8.1 custom index configuration example for web db. To be placed in \app_config\include\customer-folder. Depends on a custom BaseConfiguration file
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<contentSearch>
<configuration type="Sitecore.ContentSearch.ContentSearchConfiguration, Sitecore.ContentSearch">
<indexes hint="list:AddIndex">
<index id="yourcustom_indexname" 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/indexConfigurations/databasePropertyStore" param1="$(id)" />
<configuration ref="contentSearch/indexConfigurations/CustomIndexBaseConfiguration" />
<strategies hint="list:AddStrategy">
<!-- NOTE: order of these is controls the execution order -->
<strategy ref="contentSearch/indexConfigurations/indexUpdateStrategies/onPublishEndAsync" />
</strategies>
<commitPolicyExecutor type="Sitecore.ContentSearch.CommitPolicyExecutor, Sitecore.ContentSearch">
<policies hint="list:AddCommitPolicy">
<policy type="Sitecore.ContentSearch.ModificationCountCommitPolicy, Sitecore.ContentSearch">
<Limit>300</Limit>
</policy>
</policies>
</commitPolicyExecutor>
<locations hint="list:AddCrawler">
<crawler type="Sitecore.ContentSearch.SitecoreItemCrawler, Sitecore.ContentSearch">
<Database>web</Database>
<Root>/sitecore/content/Your-website-root</Root>
</crawler>
</locations>
<enableItemLanguageFallback>false</enableItemLanguageFallback>
<enableFieldLanguageFallback>false</enableFieldLanguageFallback>
<!--
<shardingStrategy type="Sitecore.ContentSearch.LuceneProvider.Sharding.LucenePartitionShardingStrategy, Sitecore.ContentSearch.LuceneProvider">
<param desc="shardDistribution">4</param>
</shardingStrategy>
-->
<!--
<shardFolders hint="raw:AddShardFolderPath">
<shard shardName="shard1" shardRootFolderPath="c:\Data\Indexes" />
<shard shardName="shard2" shardRootFolderPath="c:\Data\Indexes" />
<shard shardName="shard3" shardRootFolderPath="c:\Data\Indexes" />
</shardFolders>
-->
</index>
</indexes>
</configuration>
</contentSearch>
</sitecore>
</configuration>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment