Sitecore ContentSearch Language Based Search
Just a quick blog on using Sitecore content search within multilingual sites.
A very basic way of achieving a multilingual search, i've used in the past involves building a query to filter on the language from the Sitecore.Context.Language. This method is explained in a previous tweet from Jamie Little and a blog post, however a comment from Stephen Pope shed more detail on content search, where you can actually pass in a culture into the content search.
So how does this work in practice
Within the Lucene or Solr configuration (e.g. "Sitecore.ContentSearch.Lucene.DefaultIndexConfiguration.config") we can see that there is a collection of analyzers specified along with the culture name the analyzer is for.
Switching analyzer for the given language
When constructing the context.GetQueryable
In the example below, I get the current cultureInfo from the context language and pass this into the GetQueryable method. This allows content search to automatically switch between analyzers based on the current site language.