3
votes

Sitecore 8.1 with default lucene. I'm using a custom index with a computed field to store the true values of a multilist field, rather than the guids. This works and I can see within the Luke tool that the field are indexed as text.

Some of the values contain spaces, but I want these to be indexed as the whole field. The problem is these are being indexed in a tokenized fashion, so for example 'Little Hampton' is being indexed as 'Little' and 'Hampton'.

How do I get computed fields to be stored untokenized? See the raw:AddComputedIndexField section:

<indexConfigurations>
    <myCustomIndexConfiguration type="Sitecore.ContentSearch.LuceneProvider.LuceneIndexConfiguration, Sitecore.ContentSearch.LuceneProvider">
    <indexAllFields>true</indexAllFields>
    <initializeOnAdd>true</initializeOnAdd>
    <analyzer ref="contentSearch/indexConfigurations/defaultLuceneIndexConfiguration/analyzer" />
    <fieldMap type="Sitecore.ContentSearch.FieldMap, Sitecore.ContentSearch">
        <fieldNames hint="raw:AddFieldByFieldName">
        <!-- you must have _uniqueid or you wont be able to update the document later -->
            <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>
            <field fieldName="title" storageType="YES" indexType="UNTOKENIZED" vectorType="YES" boost="1f" type="System.String" settingType="Sitecore.ContentSearch.LuceneProvider.LuceneSearchFieldConfiguration, Sitecore.ContentSearch.LuceneProvider" />
            <field fieldName="summary" storageType="NO" indexType="TOKENIZED" vectorType="YES" boost="1f" type="System.String" settingType="Sitecore.ContentSearch.LuceneProvider.LuceneSearchFieldConfiguration, Sitecore.ContentSearch.LuceneProvider" />  
        </fieldNames>
    </fieldMap>
    <fields hint="raw:AddComputedIndexField">
        <!-- resolves selected guids to text values -->
        <field storageType="NO" indexType="UNTOKENIZED" fieldName="my multilist field">My.CoolStuff.Class, My.CoolStuff</field>
    </fields>

I've tried adding storageType="NO" indexType="UNTOKENIZED" to the field but without affect, it remains tozenized and stored.

2

2 Answers

1
votes

Try and add your computed field to the regular <fieldNames hint="raw:AddFieldByFieldName"> section IN ADDITION to the computed field, and specify an analyzer.

for example:

<fieldNames hint="raw:AddFieldByFieldName">
  <field fieldName="my multilist field" 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>
-1
votes

I can suggest one thing for you and it should work:

Create a computed field that replacing the spaces in title field with " _ ", when you search replace any the space in your search keyword with " _ " so your it will be like : Little_Hampton