TransWikia.com

Search checklist field data in the Content search API in Sitecore SXA

Sitecore Asked by Sonu on August 23, 2021

I would like to search checklist data through the Content search API in the Sitecore SXA. However, it is not searching any data based on checked value in checklist field.

Sharing code :

Template:
Name         Type
Topic        CheckList

Field in the Content Editor :

enter image description here

Property :

 public string Topic { get; set; }

Code I am using for searching:

predicate = predicate.And(x => x.Topic.Contains(filters.Topic)); 

We are passing data through filters.
Such as filter value is "Topic 1" here.

Index configuration :

<contentSearch>
      <indexConfigurations>
        <defaultSolrIndexConfiguration type="Sitecore.ContentSearch.SolrProvider.SolrIndexConfiguration, Sitecore.ContentSearch.SolrProvider" search:require="solr">
          <documentOptions type="Sitecore.ContentSearch.SolrProvider.SolrDocumentBuilderOptions, Sitecore.ContentSearch.SolrProvider">
            <fields hint="raw:AddComputedIndexField">
               <field fieldName="topic"     type="Sitecore.XA.Foundation.Search.ComputedFields.ResolvedLinks, Sitecore.XA.Foundation.Search"  returnType="stringCollection" referenceField="topic"        contentField="title" />
            </fields>
          </documentOptions>
          <fieldMap>
            <fieldNames>
               <field fieldName="topic"      returnType="guid"   storageType="YES" indexType="UNTOKENIZED" vectorType="NO" boost="1f" settingType="Sitecore.ContentSearch.LuceneProvider.LuceneSearchFieldConfiguration, Sitecore.ContentSearch.LuceneProvider" />
            </fieldNames>
          </fieldMap>
        </defaultSolrIndexConfiguration>
 </indexConfigurations>
</contentSearch>

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP