Skip to content

Instantly share code, notes, and snippets.

@lowedown
Created October 30, 2015 15:24
Show Gist options
  • Save lowedown/7cc68e593d184ed41e71 to your computer and use it in GitHub Desktop.
Save lowedown/7cc68e593d184ed41e71 to your computer and use it in GitHub Desktop.
Minimal Sitecore Index configuration with language
<myLanguageSearchConfiguration type="Sitecore.ContentSearch.LuceneProvider.LuceneIndexConfiguration, Sitecore.ContentSearch.LuceneProvider">
<indexAllFields>false</indexAllFields>
<initializeOnAdd>true</initializeOnAdd>
<analyzer ref="contentSearch/indexConfigurations/defaultLuceneIndexConfiguration/analyzer" />
<fieldMap type="Sitecore.ContentSearch.FieldMap, Sitecore.ContentSearch">
<fieldNames hint="raw:AddFieldByFieldName">
<!-- Needed for updating documents in the index -->
<field fieldName="_uniqueid" 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>
<!-- Makes sure the language field is indexed using the correct analyzer -->
<field fieldName="_language" 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>
</fieldNames>
</fieldMap>
<fieldReaders ref="contentSearch/indexConfigurations/defaultLuceneIndexConfiguration/fieldReaders"/>
<indexFieldStorageValueFormatter ref="contentSearch/indexConfigurations/defaultLuceneIndexConfiguration/indexFieldStorageValueFormatter"/>
<indexDocumentPropertyMapper ref="contentSearch/indexConfigurations/defaultLuceneIndexConfiguration/indexDocumentPropertyMapper"/>
</myLanguageSearchConfiguration>
@lowedown
Copy link
Author

This is a minimal custom Sitecore index configuration based on Mikkel Holck Madsen's Blog post: http://www.mikkelhm.dk/blog/defining-a-custom-index-in-sitecore-7-the-absolute-minimum

Only difference is the _language field which is used for querying documents in a specific language.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment