You are here

function apachesolr_multilingual_node_update in Apache Solr Multilingual 7

Same name and namespace in other branches
  1. 6.3 apachesolr_multilingual.module \apachesolr_multilingual_node_update()

Implements hook_node_update().

Return value

void

2 calls to apachesolr_multilingual_node_update()
apachesolr_multilingual_node_delete in ./apachesolr_multilingual.module
Implements hook_node_delete().
apachesolr_multilingual_node_insert in ./apachesolr_multilingual.module
Implements hook_node_insert().

File

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

Code

function apachesolr_multilingual_node_update($node) {

  // If a node is translated using node translation aka content translation
  // we need to mark all translations as modified to update field
  // sm_translations, sm_missing_translations and CLIR.
  if (!empty($node->tnid)) {
    foreach (apachesolr_multilingual_load_all_environments() as $environment) {
      if (!empty($environment['index_bundles']['node']) && in_array($node->type, $environment['index_bundles']['node'])) {
        $translations = translation_node_get_translations($node->tnid);
        foreach ($translations as $node_stub) {
          if ($node_stub->nid != $node->nid) {
            apachesolr_mark_entity('node', $node_stub->nid);
          }
        }
        return;
      }
    }
  }

  // For entity translation the deletion of an entity / node is the only case
  // requires some special handling. But this is done internally using the
  // sm_parent_document_id field.
  // See apachesolr_multilingual_apachesolr_index_documents_alter().
}