I have a site which is setup with 2 languages. Primary language is English. If I do a search in English then I can find all content and get search results. When searching in the second language I only get results if the search term is present in content in both languages.

So if Node23 has the word "plant" in both English and the translation in the 2nd language too then I will have a search result in the 2nd language. Result shown is in the 2nd language.

If node23 contains the word "plant" only in the 2nd language then I get no results. What can I do to fix this issue? Looks like indexing only takes place on the primary language and when found it is displayed in the second language.

I tried built in search, Display suite search and Search configuration module. Very strange behavior if you can build a multilingual site but can not search.


I do not as yet have significant experience with internationalisation in drupal.

Having said that, if you would like greater control over your search indexes I would definitely look at using search api instead of the default drupal search.

As well as allowing you to pick which fields are indexed, it also abstracts your search index so that you can take advantage of Apache solr etc. In your case, at least to start, I would suggest you stick to the simple database backend for search api.

The more flexible approach of search api brings additional functionality via other modules. For your use case I would look at Search API Entity Translation, which

generates separate search index items for all/selected available languages for each translatable entity

It looks like this relies on entity translation rather than internationalisation, so make sure you survey any potential implications for translation of your content first.


You could overwrite the search functionality by adding a view for your search results, and add a filter to be the Current User's Language (site language).

If you decide doing this, you might also need to override the search box, for which you can expose form block (set it to YES). By doing this, the search box will be available as a block, so you can place it in any region of your page (or even embed it in your code if needed).

Your view might look like this one:

enter image description here


This is how I approach it.

Create a hook_node_update_index() in your custom module with the following code.

 * Implements hook_node_update_index().
 * @see _node_index_node() function in modules/node/node.module
function hook_node_update_index($node) {
  global $language;
  $languages = language_list();

  $text = '';
  foreach (array_keys($languages) as $langcode) {
    $build = node_view($node, 'search_index', $langcode);
    $node->rendered = drupal_render($build);

    $text.= '<h1>' . check_plain($node->title) . '</h1>' . $node->rendered;

  return $text;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.