You are here

function apachesolr_multilingual_nodeapi in Apache Solr Multilingual 6

Same name and namespace in other branches
  1. 6.3 apachesolr_multilingual.module \apachesolr_multilingual_nodeapi()
  2. 6.2 apachesolr_multilingual.module \apachesolr_multilingual_nodeapi()

Implements hook_nodeapi().

Parameters

$node:

$op:

$a3:

$a4:

Return value

mixed

File

./apachesolr_multilingual.module, line 24
Multilingual search using Apache Solr.

Code

function apachesolr_multilingual_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
  switch ($op) {
    case 'delete':
    case 'insert':
    case 'update':
      if (variable_get('apachesolr_multilingual_index_translations', 0) && !empty($node->tnid)) {
        $translations = translation_node_get_translations($node->tnid);
        foreach ($translations as $language => $translation) {
          if ($translation->nid != $node->nid) {
            if ($translation_node = node_load($translation->nid)) {
              _apachesolr_nodeapi_update($translation_node);
            }
          }
        }
      }
      break;
  }
}