I am using Sitecore 9 Update 1 with Sitecore Azure search. We have many different language content in the site. I want to index the content which are belongs to 2 languages. Is there any change to be done at config side?
1 Answer
This is vague, but let me try to interpret what you're asking. You have many languages in your solution, but you'd like to just index 2 of those languages -- you DO NOT want the other languages to be indexed.
If this is the case, I'd suggest storing content for those 2 languages into their own custom index that only defines those languages. This "domain index" pattern is common for Sitecore and has additional benefits (like quicker speed as it's focused on just the 2 indexes you want). You can read more about domain indexes at When and why to create a custom index on Stackexchange.
Given that you're using Azure Search, you'd probably focus on the cloudCultureBasedAnalyzerConfiguration section of the search index configuration and include just the two languages in question.
Drawing on App_Config\Sitecore\ContentSearch.Azure\Sitecore.ContentSearch.Azure.DefaultIndexConfiguration.config for example, the languages are configured in cloudCultureBasedAnalyzerConfiguration like in
<sitecore>
<contentSearch>
<indexConfigurations>
<defaultCloudIndexConfiguration>
...
<cloudCultureBasedAnalyzerConfiguration type="Sitecore.ContentSearch.Azure.Analyzers.CloudCultureBasedAnalyzerConfiguration, Sitecore.ContentSearch.Azure">
<analyzers hint="raw:AddAnalyzer">
<cloudAnalyzer cultureCode="bg" analyzer="bg.lucene" />
<cloudAnalyzer cultureCode="hy" analyzer="hy.lucene" />
...
</analyzers>
</cloudCultureBasedAnalyzerConfiguration>
</defaultCloudIndexConfiguration>
</indexConfigurations>
"bg" is for Bulgarian, "hy" is for Armenian, etc.
By isolating the two languages you want into your own custom "domain index" you can index it by specific rules just for them, rebuild the index just for them, and query just that index giving you 100% control over how and when that index is used.