Issues with the Lucene search provider and Sitecore fields that have spaces in the names


Description

The following issues may occur when using the Lucene search provider and dealing with Sitecore fields that have whitespaces in their names:

  1. The value of the field may not be stored in the index even though the storage type of the field is set to YES in the index configuration.
  2. The analyzer associated with the field may be ignored both during indexing and searching. The default analyzer is used instead.

Solution

For every affected field, two entries should be added to the index configuration:

  1. To resolve the issue with the storage type, add the following entry (this is an example, use whitespaces in the field name):
    <field fieldName="{my field name}" 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>
  2. To resolve the issue with the analyzer, add the following entry (this is an example, replace whitespaces with the underscores in the field name):
    <field fieldName="{my_field_name}" 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>

Search indexes must be rebuilt for the changes to take effect.