Language specific search

Last updated Thursday, June 21, 2018 in Sitecore Experience Platform for Developer
Keywords: Development, Search

The Search API has two elements you can use to implement content search that only searches in one language: CultureExecutionContext and InContext.

This example shows how you can use them:

var index = ContentSearchManager.GetIndex("sitecore_master_index");
using (var context = index.CreateSearchContext())
    var cultureZh = new CultureExecutionContext(CultureInfo.GetCultureInfo("zh-TW"));
    var result = context.GetQueryable<TestSearchResultItem>(cultureZh)
.Where(it => it.Title == "Home").ToArray();
    var result2 = context.GetQueryable<TestSearchResultItem>()
                 .Where(it => it.Title == "Home").ToArray();


<field fieldName="title" returnType="text" />
public class TestSearchResultItem : SearchResultItem
    public string Title { get; set; }

Send feedback about the documentation to