HomeGuidesAPI ReferenceGraphQL
Submit Documentation FeedbackJoin Developer CommunityOptimizely GitHubOptimizely NuGetLog In

Language-specific queries

This topic describes how to create queries that apply to specific languages.

When an Optimizely Search & Navigation index is set up, you define its supported languages. 

How it works

When setting up an index, you define its supported languages, see Architecture for a complete list of 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.

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

Example

An instance for each supported language is exposed as a static property on the Language class.

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

📘

Note

The language parameter only applies when specifying one or more fields in which to search. If you do not specify fields, the search is made over the special _all field, which supports only a single analyzer. Likewise, when searching attachments (Word documents, PDFs, etc.), the standard analyzer is used.

Result of adding a language parameter

If you specify a language, the search uses stemmingadapted for that language. In such a case, results are returned in all languages and for stemmed words in the specified language. To limit results to a specific language, use a filter (for example, FilterForVisitor).


Next