API
Version 7.x > API > Select custom search index according to language/culture in search results View modes: 
User avatar
Certified Developer 8
Certified Developer 8
nrinat-ecentricarts - 6/14/2013 4:14:46 PM
   
Select custom search index according to language/culture in search results
Hello

I have a bilingual site with a custom search index (for media library files) for each language.

In the search results page I would like to select what index to search according to the current language (right now all indexes are searched regardless of the current culture so the user gets results in foreign languages). I thought about using a macro or tailor the code, but I'm not sure what is the best way and where to begin.

Would appreciate an advice.

Thank you!

Norm

User avatar
Member
Member
kentico_sandroj - 6/14/2013 9:28:45 PM
   
RE:Select custom search index according to language/culture in search results
Hi Norm,

There are two options:

You can have both cultures in the same index and specify the culture code property in the Web part to be: {%CurrentDocument.DocumentCulture%} - this would ensure that only documents in the currently selected culture show in the results.

Alternatively, you can proceed with your current setup and use a K# statement to evaluate the current culture, using the same macro, and output the appropriate index name. Let me know if you need any help with the syntax.

Does that help?

Regards,
Sandro