Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save vince-geekcore/d5771718930956982253 to your computer and use it in GitHub Desktop.
Save vince-geekcore/d5771718930956982253 to your computer and use it in GitHub Desktop.
Sitecore 8.1 ContentSearch Base Configuration file (to be referenced in index configuration)
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<contentSearch>
<indexConfigurations>
<!-- If no configuration is specified for an index, it uses the default configuration. The configurations are not merged if the index also has a
configuration. The system uses either the default configuration or the index configuration. -->
<CustomIndexBaseConfiguration type="Sitecore.ContentSearch.LuceneProvider.LuceneIndexConfiguration, Sitecore.ContentSearch.LuceneProvider">
<!-- This flag will index all fields by default. This allows new fields in your templates to automatically be included into the index.
You have two choices :
1) Set this to 'true' and place all the fields that you would like to remove in the 'ExcludeField' list.
2) Set to false and place all fields you would like to be indexed in the 'IncludeField' list below.
-->
<indexAllFields>true</indexAllFields>
<!-- Should index Initialize() method be called as soon as the index is added or wait for an external trigger -->
<initializeOnAdd>true</initializeOnAdd>
<!-- Re-use from the default lucene configuration.. -->
<Analyzer ref="contentSearch/indexConfigurations/defaultLuceneIndexConfiguration/analyzer"/>
<fieldMap ref="contentSearch/indexConfigurations/defaultLuceneIndexConfiguration/fieldMap">
<fieldNames hint="raw:AddFieldByFieldName">
<!-- Custom computed fields examples -->
<field fieldName="customindex_productgroup_url" storageType="YES" indexType="TOKENIZED" vectorType="NO" boost="1f" type="System.String" settingType="Sitecore.ContentSearch.LuceneProvider.LuceneSearchFieldConfiguration, Sitecore.ContentSearch.LuceneProvider">
<Analyzer type="Sitecore.ContentSearch.LuceneProvider.Analyzers.LowerCaseKeywordAnalyzer, Sitecore.ContentSearch.LuceneProvider" />
</field>
<field fieldName="customindex_product_content" storageType="NO" indexType="TOKENIZED" vectorType="NO" boost="1f" type="System.String" settingType="Sitecore.ContentSearch.LuceneProvider.LuceneSearchFieldConfiguration, Sitecore.ContentSearch.LuceneProvider">
<Analyzer type="Sitecore.ContentSearch.LuceneProvider.Analyzers.LowerCaseKeywordAnalyzer, Sitecore.ContentSearch.LuceneProvider" />
</field>
</fieldNames>
</fieldMap>
<!-- Re-use from the default lucene configuration.. -->
<fieldReaders ref="contentSearch/indexConfigurations/defaultLuceneIndexConfiguration/fieldReaders"/>
<virtualFieldProcessors hint="raw:AddVirtualFieldProcessor">
<virtualFieldProcessor fieldName="daterange" type="Sitecore.ContentSearch.VirtualFields.DateRangeFieldProcessor, Sitecore.ContentSearch"/>
<virtualFieldProcessor fieldName="updateddaterange" type="Sitecore.ContentSearch.VirtualFields.UpdatedDateRangeFieldProcessor, Sitecore.ContentSearch"/>
<virtualFieldProcessor fieldName="_lastestversion" type="Sitecore.ContentSearch.VirtualFields.LatestVersionFieldProcessor, Sitecore.ContentSearch"/>
<virtualFieldProcessor fieldName="_url" type="Sitecore.ContentSearch.VirtualFields.UniqueIdFieldProcessor, Sitecore.ContentSearch"/>
</virtualFieldProcessors>
<!-- INCLUDE TEMPLATES IN INDEX
This setting allows you to only include items that are based on specific templates in the index. You must specify all the
templates that you want to include, because template inheritance is not checked.
When you enable this setting, all the items that are based on other templates are excluded, regardless of whether the template
is specified in the ExcludeTemplate list or not.
-->
<include hint="list:IncludeTemplate">
<About>{10BE58BB-BE47-4756-BF9E-A8DA88EC1BEC}</About>
<Management>{VA1B6C6C-CBCD-43E8-AF8D-D1EEB37B029B}</Management>
<Event>{AA1B6D6C-CBCD-43E8-AF8D-D1EEB37B029B}</Event>
<EventListing>{455F2C7B-4F8B-4415-8C5C-747EE3FB5AEC}</EventListing>
<Markets>{E6FECD1B-92B2-4CDE-99B7-07118A155985}</Markets>
<Market>{5D5B2FDB-74E5-4DBA-9895-763962DED547}</Market>
<Detail>{5E64F85A-08F9-4B14-9044-911FBCD9372F}</Detail>
<News>{2A6585D7-7FF4-41EF-83D0-FB260591A235}</News>
<NewsListing>{D3DB4D1C-C224-408F-AB76-8EA0B4BC41FD}</NewsListing>
<Solution>{BF76544F-B170-4987-BFF8-EE41EC08709C}</Solution>
<SolutionListing>{A612F675-E4CF-4A51-9490-0CA6605E0C7A}</SolutionListing>
<Submarket>{9CA25CB5-F21D-4340-8734-04AEC5953D28}</Submarket>
<Vacancy>{67B764CF-831B-4C1D-A857-89A69400C244}</Vacancy>
</include>
<!-- INCLUDE FIELDS IN INDEX
This setting allows you to specify which fields to include in the index when the indexAllFields setting is set to false.
-->
<include hint="list:IncludeField">
</include>
<!-- COMPUTED INDEX FIELDS
This setting allows you to add fields to the index that contain values that are computed for the item that is being indexed.
You can specify the storageType and indextype for each computed index field in the <fieldMap><fieldNames> section.
-->
<fields hint="raw:AddComputedIndexField">
<field fieldName="customindex_productgroup_url" storageType="YES" indexType="UNTOKENIZED">
Customer_Platform.Library.Search.Computed_Fields.ProductGroupUrl,Customer_Platform.Library
</field>
<field fieldName="customindex_product_content" storageType="NO" indexType="TOKENIZED">
Customer_Platform.Library.Search.Computed_Fields.ProductGroupContent,Customer_Platform.Library
</field>
</fields>
<!-- Re-use from the default lucene configuration.. -->
<Analyzer ref="contentSearch/indexConfigurations/defaultLuceneIndexConfiguration/analyzer"/>
<indexFieldStorageValueFormatter ref="contentSearch/indexConfigurations/defaultLuceneIndexConfiguration/indexFieldStorageValueFormatter"/>
<indexDocumentPropertyMapper ref="contentSearch/indexConfigurations/defaultLuceneIndexConfiguration/indexDocumentPropertyMapper"/>
<!-- DOCUMENT BUILDER
Allows you to override the document builder. The document builder class processes all the fields in the Sitecore items and prepares
the data for storage in the index.
You can override the document builder to modify how the data is prepared, and to apply any additional logic that you may require.
-->
<documentBuilderType>Sitecore.ContentSearch.LuceneProvider.LuceneDocumentBuilder, Sitecore.ContentSearch.LuceneProvider</documentBuilderType>
</CustomIndexBaseConfiguration>
</indexConfigurations>
</contentSearch>
</sitecore>
</configuration>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment