I am working on the search for my site. It is working as expected for the most part, but I noticed that if I add a link list with multiple links, the text from those links does not show up in the search. I have tried going to the link and link list template and letting them inherit the searchable template. I then published everything and rebuilt the indexes, and the links are still not showing up in the search. Everything I am doing is OOTB.
1 Answer
I don't think that the text from the links set in a link list are indexed by default. SXA comes with a computed field sxacontent
which is aggregating all texts from all fields of an item and uses the implementation in Sitecore.XA.Foundation.Search.ComputedFields.AggregatedContent
. It is configured in \App_Config\Include\z.Foundation.Overrides\Sitecore.XA.Foundation.Search.Solr.config
.
If you take a look using any decompiler in the Sitecore.XA.Foundation.Search.dll there is a method which extracts the values for each field
protected virtual IEnumerable<object> ExtractTextFields(Item item, ProviderIndexConfiguration config)
{
if (!config.DocumentOptions.ExcludedTemplates.Contains(item.TemplateID.ToString()))
{
item.Fields.ReadAll();
foreach (SitecoreItemDataField sitecoreItemDataField in this.GetNonStandardField(item))
{
if (IndexOperationsHelper.IsTextField((IIndexableDataField) sitecoreItemDataField) && !config.DocumentOptions.ExcludedFields.Contains(sitecoreItemDataField.Id.ToString()))
{
string fieldValue = config.FieldReaders.GetFieldValue((IIndexableDataField) sitecoreItemDataField) as string;
if (!string.IsNullOrEmpty(fieldValue))
yield return (object) fieldValue;
}
}
}
}
The method IndexOperationsHelper.IsTextField is determining what field will be indexed by default:
private static readonly List<string> TextFieldTypes = new List<string>()
{
"Single-Line Text",
"Rich Text",
"Multi-Line Text",
"text",
"rich text",
"html",
"memo",
"Word Document"
};
You would need to add your custom implementation and override the configuration node `