9

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

6
  • 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
    Commented Sep 26, 2018 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? Commented Sep 26, 2018 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
    Commented Sep 26, 2018 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 Commented Sep 26, 2018 at 13:22
  • 1
    Well, you should not add field types suffixes in the facet item Field Name field. The type should be automatically resolved by Sitecore logic. Take a look at how it's working e.g.: with Title. Check the search.log and you will see that _t suffix is automatically added by search logic. Which mean that the type has been automatically resolved. Commented Sep 27, 2018 at 7:43

4 Answers 4

9

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

3
  • 1
    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
    Commented Sep 12, 2019 at 14:29
  • @zhanke did you manage to find the solution with the whitespace in between the facet words for Sitecore 9.2 with SXA 1.9? Commented Jan 15, 2020 at 11:33
  • @ReyRahadian it's a bug, you can request a patch from Sitecore Support
    – zhanke
    Commented Jan 15, 2020 at 13:13
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 ;)

1
  • Unfortunately this is not working @Gatogordo. See Resolution 2 in my answer for further details Commented Sep 26, 2018 at 15:50
0

you don't need to change your field type to "tag tree", Just add this tag
to fieldReaders tag in your search configuration, then rebuild the indexes, you will find *_sm value in solr will retrieve the name instead of item Guild

enter image description here

0

Changing the field to tag treelist, publish and re-index will resolve this. SXA stores tags as the title value, not the ID. Checking the values in SOLR for sxaTags field confirms if the issue is resolved (showing titles) or not (showing id's)

Your Answer

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

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