1

Any idea why my master and web index only have the "en" language versions of items in my 4 language site?

Where are languages for the crawler configured?

3

The languages are specified in the schema.xml file. Please look in yours and make sure you see this section.

<dynamicField name="*_t" type="text_general" indexed="true" stored="true" />
<dynamicField name="*_t_en" type="text_general" indexed="true" stored="true" />
<dynamicField name="*_t_ar" type="text_ar" indexed="true" stored="true" />
<dynamicField name="*_t_bg" type="text_bg" indexed="true" stored="true" />
<dynamicField name="*_t_ca" type="text_ca" indexed="true" stored="true" />
<dynamicField name="*_t_cz" type="text_cz" indexed="true" stored="true" />
<dynamicField name="*_t_da" type="text_da" indexed="true" stored="true" />
<dynamicField name="*_t_de" type="text_de" indexed="true" stored="true" />
<dynamicField name="*_t_el" type="text_el" indexed="true" stored="true" />
<dynamicField name="*_t_es" type="text_es" indexed="true" stored="true" />
<dynamicField name="*_t_eu" type="text_eu" indexed="true" stored="true" />
<dynamicField name="*_t_fa" type="text_fa" indexed="true" stored="true" />
<dynamicField name="*_t_fi" type="text_fi" indexed="true" stored="true" />
<dynamicField name="*_t_fr" type="text_fr" indexed="true" stored="true" />
<dynamicField name="*_t_ga" type="text_ga" indexed="true" stored="true" />
<dynamicField name="*_t_gl" type="text_gl" indexed="true" stored="true" />
<dynamicField name="*_t_hi" type="text_hi" indexed="true" stored="true" />
<dynamicField name="*_t_hu" type="text_hu" indexed="true" stored="true" />
<dynamicField name="*_t_hy" type="text_hy" indexed="true" stored="true" />
<dynamicField name="*_t_id" type="text_id" indexed="true" stored="true" />
<dynamicField name="*_t_it" type="text_it" indexed="true" stored="true" />
<dynamicField name="*_t_ja" type="text_ja" indexed="true" stored="true" />
<dynamicField name="*_t_lv" type="text_lv" indexed="true" stored="true" />
<dynamicField name="*_t_nl" type="text_nl" indexed="true" stored="true" />
<dynamicField name="*_t_no" type="text_no" indexed="true" stored="true" />
<dynamicField name="*_t_pt" type="text_pt" indexed="true" stored="true" />
<dynamicField name="*_t_ro" type="text_ro" indexed="true" stored="true" />
<dynamicField name="*_t_ru" type="text_ru" indexed="true" stored="true" />
<dynamicField name="*_t_sv" type="text_sv" indexed="true" stored="true" />
<dynamicField name="*_t_th" type="text_th" indexed="true" stored="true" />
<dynamicField name="*_t_tr" type="text_tr" indexed="true" stored="true" />
<dynamicField name="*_t_zh" type="text_zh" indexed="true" stored="true" />

Then to filter on the language inherit a new ResultItem from the class SearchResultItem, adding this code.

 [IndexField("_language")]
 public string Language { get; set; }

In your search query you can then filter on the language.

var index = ContentSearchManager.GetIndex("sitecore_master_index");
using (var context = index.CreateSearchContext())
{
     var query = context.GetQueryable<SearchResultItem>().Where(i => i.Name.Contains("search")).Filter(i => i.Language == "en");
     query = query.Page(1, 20);
     var results = query.GetResults();
}
8
  • I have that in my schema.xml for solr, and see the _language field in the index - but the only things there are "en". Nov 12 '16 at 17:00
  • Are you looking at the index for sitecore_master_index? Have you modified the Sitecore.ContentSearch.Lucene.Index.Master.config config file at all?
    – Chris Auer
    Nov 12 '16 at 17:10
  • Yes. Using the Solr configs - disabled all the Lucene ones. Nov 12 '16 at 17:26
  • I'm going to mark this answer correct, and add some onto it. This was down the right path. Nov 12 '16 at 17:31
  • Thank you, can you describe what you found that fixed your issue?
    – Chris Auer
    Nov 12 '16 at 17:45

This site is temporarily in read only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .