0

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>
13
  • Have you tried passing ID of the topic 1?
    – Marek Musielak
    Jul 16, 2020 at 9:38
  • yes, i have tried this but it was not working.
    – Ashish
    Jul 16, 2020 at 9:49
  • @Marek , I am checking Sitecore SXA is not creating any index for this field. Is it the issue ?
    – Ashish
    Jul 16, 2020 at 10:43
  • Use solr admin to check if the field is populated and what are the values in it. Then check search.log to see what is the query which is sent to solr.
    – Marek Musielak
    Jul 16, 2020 at 10:54
  • 1
    As far i can see from the config you have provided, at the first line you have given returnType as stringCollection and second time you have given it as guid. Can you just change both of them to either "guidCollection" or "stringCollection". If you use guidCollection try to use IEnumberable<Guid> in model and if string collection try to use IEnumerable<string> in the model. Please let me knw the results. Jul 20, 2020 at 16:42

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.