I need to update Solr schema for text highlighting using code.
What is the way to update Solr schema using code in Sitecore 10.3?
Since 'SolrProvider.GetHelper is obsolete'
It's all described in Sitecore documentation here:
In shortcut:
ISchemaPopulateHelper
implementation, best by overriding SchemaPopulateHelper
, e.g.public class CustomPopulateHelper : SchemaPopulateHelper
{
public CustomPopulateHelper(SolrSchema schema) : base(schema)
{
}
...
}
public class CustomPopulateHelperFactory : IPopulateHelperFactory
{
public ISchemaPopulateHelper GetPopulateHelper(SolrSchema solrSchema)
{
return new CustomPopulateHelper(solrSchema);
}
}
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<pipelines>
<contentSearch.PopulateSolrSchema>
<processor type="Sitecore.ContentSearch.SolrProvider.Pipelines.PopulateSolrSchema.PopulateFields, Sitecore.ContentSearch.SolrProvider">
<param type="Documentation.Examples.CustomPopulateHelperFactory, Documentation.Examples" patch:instead="*[@type='Sitecore.ContentSearch.SolrProvider.Factories.DefaultPopulateHelperFactory']"/>
</processor>
</contentSearch.PopulateSolrSchema>
</pipelines>
</sitecore>
</configuration>