Lucene Sitecore Fields with Spaces

Posted by Xing Liu on 4/1/2016

While working with the Lucene content search API, we encountered an issue trying to search the field content that set storage type to YES. We had a Sitecore field name with space in it - “field name”. In the custom configuration, we added the following setting:

<field fieldName="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>

However, when we removed the space in the field name as well as in the configuration fieldname attribute, the Lucene search did return value from that field.

It turns out that this issue was documented in the Sitecore Knowledge Base. To resolve this problem, we need to add another configuration entry with spaces in the field name:

<field fieldName="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>

Here is the link to the Knowledge Base: https://kb.sitecore.net/articles/036144



CONTACT SYMSOFT SOLUTIONS

Looking for a partner who will exceed your expectations? Get in touch.

Name
*
Message
*
SYMSOFT SOLUTIONS 4090 Truxel Road, Suite 200 Sacramento, CA 95834
United States (916) 567-1740