Disclaimer: This website requires Please enable JavaScript in your browser settings for the best experience.

HomeDev GuideRecipesAPI Reference
Dev GuideAPI ReferenceUser GuideGitHubNuGetDev CommunityOptimizely AcademySubmit a ticketLog In
Dev Guide

Language-specific queries

Describes how to create queries that apply to specific languages.

When you set up an index, you define its supported languages. When searching a defined language, you use the Client class and the Search extension method, and pass to the Search extension method an instance of the Language class.

Optimizely Search & Navigation also has a Language routing feature that lets you limit search queries to documents in a specified language.

Optimizely Search & Navigation exposes an instance for each supported language as a static property on the Language class.

client.Search<BlogPost>(Language.Swedish)
    .For("turtles")
    .InField(x => x.Title);

The language parameter only applies when specifying one or more fields to search. If you do not select fields, Optimizely Search & Navigation searches over the special _all field, which supports only a single analyzer. Likewise, it uses the standard analyzer when searching attachments (Word documents, PDFs, and so on).

When a language is specified, the search applies stemming tailored to that language. Consequently, when you include a language parameter, Optimizely Search & Navigation provides results across all languages and for stemmed words in the specified language. To restrict results to a particular language, use a filter (such as, FilterForVisitor).