Imagine a situation where you have users from different countries and you would like to give them a choice to only see content you index that is written in their native language. Sounds quite interesting, right? Let us see how we can identify the language of the documents during indexing and store that information along with the documents in the index for later use.
For the language identification we will use one of the Solr contrib modules, but let's start from the beginning.
For the purpose of the recipe, I assume that we will be using the following index structure (add the following to the
fields
section of yourschema.xml
file):<field name="id" type="string" indexed="true" stored="true" required="true" multiValued="false" /> <field name="name" type="text_general" indexed="true" stored="true"/> <field name="description" type="text_general" indexed="true" stored="true" /> <field name="langId" type="string" indexed="true...