Last updated: Apr 06 2018

Area: Episerver Find Applies to versions: 13 and higher

Language Routing support

The Find CMS integration includes Language Routing support for content that implements ILocale. Most content base types, like PageData, ProductContent, NodeContent, and VariationContent, implement ILocale. You can disable Language Routing support by using conventions or overriding LanguageRoutingFactory.

Disable Language Routing support via conventions

The following example changes the behavior of content that implements ILocale by storing documents in the old way. It’s not recommended to do this, since it negates the Language Routing feature's performance improvements.

client.Conventions.ForInstancesOf<ILocale>().LanguageRoutingIs(x => null);

The example below changes the behavior for MediaData only. You might want to do this for specific content types if it is necessary to analyze content using all analyzers.

client.Conventions.ForInstancesOf<MediaData>().LanguageRoutingIs(x => null);

Disable Language Routing support via LanguageRoutingFactory

By default, LanguageRoutingFactory adds language routing to content that implements ILocale. To disable the default behavior, create your own factory that inherits from LanguageRoutingFactory, and override any protected virtual methods. You also need to register your custom Language Routing factory using a configurable module.

[InitializableModule]
[ModuleDependency(typeof(IndexingModule))]
public class MyFindInitializationModule : IConfigurableModule
{
     public void Initialize(InitializationEngine context)
     {
     }
     public void Uninitialize(InitializationEngine context)
     {
     }
     public void ConfigureContainer(ServiceConfigurationContext context)
     {
         context.Services.AddSingleton<LanguageRoutingFactory, MyLanguageRoutingFactory>();
     }
}
The following example changes the behavior to use all analyzers instead of the “standard” analyzer for all content whose language cannot be mapped to any analyzer.
public class MyLanguageRoutingFactory : LanguageRoutingFactory
{
     public override LanguageRouting CreateLanguageRouting(ILocale locale)
     {
         var languageRouting = base.CreateLanguageRouting(locale);
         if (languageRouting.FieldSuffix == Language.None.FieldSuffix)
         {
             return null;
         }
         return languageRouting;
     }
}

Note: After upgrading to Find 13, reindex the whole site as soon as possible.

Comments