7

Introduction

We are using Sitecore 9 Update 2 with SXA 1.7.1.

We have implemented "Download Center" using OOTB search components from SXA.

We would like to show "Title" value of Checklist field instead of GUIDs in Filter(Checklist) component.

Question

How we can show value of "Title" field instead of indexed GUIDs in filter (checklist) component?

enter image description here

Setup of solution

Custom Template that we have created (inherits Foundation interface template _Searchable + adds new fields): enter image description here

We have created hierarchy of tags under Data > Tags (we are refering to these from template as can be seen above):

enter image description here

This is how it looks like on item itself:

enter image description here

Setup of Checklist filter (same is done also for remaining fields):

enter image description here

How we should configure this to show Title field instead of GUID?

This is how the facet is configured (which is referenced in above checklist filter setup):

enter image description here

This is how the filter looks now:

enter image description here

Resolution 1 - Filtering not working

I have tried to use Tag Treelist instead and created another field. It solved somehow the issue as I can see topic instead of ID but filtering is not working in this case:

enter image description here

Resolution 2 - Facets not displayed

I have also tried to create new indexed fields instead but it is also not working with them (no values can be filtered):

enter image description here

This is how fields are indexed:

enter image description here

I have set facets accordingly:

enter image description here

enter image description here

I have used name with "_sm" suffix as suggested by Gatogordo so full field name is specified as it is indexed in Solr:

enter image description here

Seems that the values are coming but they are not rendered:

enter image description here

  • 1
    Check sitecore.stackexchange.com/questions/8861/… My answer there is correct but not accepted so can't mark it as duplicate.. I could copy it here :) – Gatogordo Sep 26 '18 at 13:18
  • I have seen that question and also updated my answer. I have tried it but it is not working. Can you maybe show where the field should be used then? – Peter Procházka Sep 26 '18 at 13:20
  • Once you created the computed fields, you should check your index and take the exact name of the fields in the index (including suffix) and put that in the config in Sitecore as "fieldname" – Gatogordo Sep 26 '18 at 13:20
  • So the field won't be referenced as topictitle but topictags_sm in facet configuration? This information was missing then from the answer @Gatogordo – Peter Procházka Sep 26 '18 at 13:22
  • True.. I'll create a new one here with that included. – Gatogordo Sep 26 '18 at 13:38
7

Looks like it works out of the box with minor config change. Ensure that all of your custom fields which stores tags are using Tag Treelist field type. Here are mine custom fields:

enter image description here

That's the only config change which I did - to be honest, I don't even know if this is required. The field type should be detected correctly anyway:

enter image description here

I've just used one of the fields in this example and filtering works fine. Numbers next to tags are correct then same with results:

enter image description here

And here is hot the TopicTags field looks like the inside of the Solr:

enter image description here

And the facet itself:

enter image description here

  • What's your search querystring look like? Mine still doesn't work with space between the facet words. In browser the url is just like xxxxx.local/search#sxatags=Two%20Words . Sitecore 9.2 with SXA 1.9. – zhanke Sep 12 at 14:29
1

You need to check this part of the documentation: https://doc.sitecore.net/sitecore_experience_accelerator/setting_up_and_configuring/configuring/extend_search#_Extend_search_to_3

This explains how to use a link type field in the facets.

Index config

Add a computed field and use that fieldname in the facet:

Add the following definition to your search configuration file:

<field fieldName="referenced"
  type="Sitecore.XA.Foundation.Search.ComputedFields.ResolvedLinks, Sitecore.XA.Foundation.Search" 
  referenceField="link"
  contentField="title"/>

where:

fieldName – attribute that defines the index field name where the value will be stored.

referenceField – attribute that defines the field name of the indexed item.

contentField – attribute that defines the field of the referenced item from which the value will be retrieved during the indexing.

Don't forget to rebuild your index after the change.

Sitecore facet config

Once the fields are added to the index, check the index to get the exact name of the field in the index (including the suffix). Put this name in your facet's fieldname.

That last part can be tricky.. if it doesn't work, check the url that is made for the facets and see if that actually has data.

Bugs

Unfortunately there are some bugs with the javascript for checkbox filters. One bug creates a lowercase version of your facet value (and it should keep the casing). Another one is on the active-facet class which is not set with multiple values or when the value has a space. If you contact support, you can get a fix.. (or just ask on Slack)

You might need to avoid spaces ;)

  • Unfortunately this is not working @Gatogordo. See Resolution 2 in my answer for further details – Peter Procházka Sep 26 '18 at 15:50

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.