Locale (language routing)
Describes how to use language routing.
NoteOptimizely Graph .NET Source SDK is optimized for CMS 12. Learn more about the C# SDK for CMS 13.
Language routing returns search results faster and more accurately by restricting the query to a specific language's content. Language routing also applies linguistic processing when you use the contains operator on a field. See the locale parameter in Optimizely Graph.
Optimizely Graph .NET Client provides the Locale and Locales methods to route queries to content in one or more specific languages.
Locale method
Locale methodThe Locale method takes one parameter: an EPiServer.ContentGraph.Api.LocaleMode enum value. The enum defines two values:
ALL– Routes the query to all language indices.NEUTRAL– Routes the query to the standard (non-localized) index.
var query = queryBuilder
.ForType<MyDocumentType>()
.Locale(LocaleMode.NEUTRAL)
.Fields(x => x.Property)
.ToQuery()
.BuildQueries();Locales method
Locales methodUse this method to route to multiple languages. The parameter is an array of System.Globalization.CultureInfo values.
var query = queryBuilder
.ForType<MyDocumentType>()
.Locales(new CultureInfo("en"), new CultureInfo("sv"))
.Fields(x => x.Property)
.ToQuery()
.BuildQueries();Updated about 8 hours ago
