I spent a bit of time searching for a resolution for this one, however most results appeared to work with SOLR (where an untokenized field simply fixed the issue). Then I came across this post on the Sitecore blog.
The fix is to define your computed index field as untokenized (which I had already done), but then to also add that same field under the standard fieldMap > fieldNames element - with the LowerCaseKeywordAnalyzer.
<fieldMap type="Sitecore.ContentSearch.FieldMap, Sitecore.ContentSearch"> <fieldNames hint="raw:AddFieldByFieldName"> <field fieldName="categoryfacet" 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> <fields hint="raw:AddComputedIndexField"> <field fieldName="categoryfacet" storageType="yes" indexType="untokenized" patch:after="field[last()]">MyProject.IndexCategory, MyProject </field> </fields>That fix worked and my facets were coming back as single phrases. Of course if you are faceting and searching on the same field, you should probably have a separate version that does not use this fix (so that searching on the individual words works as expected).
No comments:
Post a Comment