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'
Sitecore Stack Exchange is a question and answer site for developers and end users of the Sitecore CMS and multichannel marketing software. It only takes a minute to sign up.
Sign up to join this communityIt'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>