0

I'm trying to use an analyzer on my computed field to allow searching with spaces. Nothing I've tried works yet. Any ideas?

<contentSearch>
      <indexConfigurations>
          <defaultSolrIndexConfiguration type="Sitecore.ContentSearch.SolrProvider.SolrIndexConfiguration, Sitecore.ContentSearch.SolrProvider">
              <fieldMap type="Sitecore.ContentSearch.SolrProvider.SolrFieldMap, Sitecore.ContentSearch.SolrProvider">
                  <fieldNames hint="raw:AddFieldByFieldName">
                      <field fieldName="firstlastname" storageType="yes" indexType="tokenized" type="string">
                        <analyzer type="Sitecore.ContentSearch.SolrProvider.Analyzers.LowerCaseKeywordAnalyzer, Sitecore.ContentSearch.SolrProvider" />
                      </field>
                  </fieldNames>
              </fieldMap>
              <documentOptions type="Sitecore.ContentSearch.SolrProvider.SolrDocumentBuilderOptions, Sitecore.ContentSearch.SolrProvider">
                  <fields hint="raw:AddComputedIndexField">
                      <field fieldName="firstlastname" storageType="yes" indexType="tokenized"> Sitecore.Fields.FirstLastNameComputedField, Circle.Fields</field>
                  </fields>
              </documentOptions>
          </defaultSolrIndexConfiguration>
      </indexConfigurations>
  </contentSearch>
0

To have included spaces into your index at population you need to specify indexType="UNTOKENIZED", and then at the indexing the spaces are not removed.

If you want to use analyser, your curent analyser remove spaces and converts into lowercase. Example: Input: "I just LOVE my Phone!" Output: "i", "just", "love", "my", "phone"

Check other analyzer if you want spaces and use untokenized for computed index field:

<field fieldName="firstlastname" storageType="yes" indexType="UNTOKENIZED"> Sitecore.Fields.FirstLastNameComputedField, Circle.Fields</field>
                  </fields>

More details about tokenizers: https://solr.apache.org/guide/7_4/tokenizers.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.