This is an ELINTS (Explain like I’m new to Sitecore) for a clear cut explanation on Sitecore’s own documentation here.
Prequel: You have a SXA search page. You needs to show some values that are reference fields that are selected with a Droplist or Multilist. By default if you add the facet it will show GUIDs.
You can search “facet showing guid” on stackexchange for answer and you will find it but if you are like me and not paying attention to it you will need this fine detail to make it work.
<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/"
xmlns:role="http://www.sitecore.net/xmlconfig/role/"
xmlns:search="http://www.sitecore.net/xmlconfig/search/">
<sitecore>
<contentSearch search:require="solr">
<indexConfigurations>
<defaultSolrIndexConfiguration type="Sitecore.ContentSearch.SolrProvider.SolrIndexConfiguration, Sitecore.ContentSearch.SolrProvider">
<documentOptions type="Sitecore.ContentSearch.SolrProvider.SolrDocumentBuilderOptions, Sitecore.ContentSearch.SolrProvider">
<fields hint="raw:AddComputedIndexField">
<field fieldName="resourceindustry" returnType="stringCollection" type="Sitecore.XA.Foundation.Search.ComputedFields.ResolvedLinks, Sitecore.XA.Foundation.Search" referenceField="industry" contentField="title"/>
<field fieldName="resourceregion" returnType="stringCollection" type="Sitecore.XA.Foundation.Search.ComputedFields.ResolvedLinks, Sitecore.XA.Foundation.Search" referenceField="region" contentField="title"/>
</fields>
</documentOptions>
</defaultSolrIndexConfiguration>
</indexConfigurations>
</contentSearch>
</sitecore>
</configuration>
the field needs to be defined in the documentOptions section. I was initially adding it to the fieldMap section and was scratching my head with vigor.
Just do it like above and use the new fieldName like below and you should be good to go.
~ Enjoy life as it is your own and no one else’ ~