You are here

function apachesolr_exclude_node_apachesolr_node_exclude in Apache Solr Exclude Node 6

Implementation of hook_apachesolr_node_exclude()

File

./apachesolr_exclude_node.module, line 96
Module file for the Apache Solr Exclude Node module.

Code

function apachesolr_exclude_node_apachesolr_node_exclude($node) {
  if (variable_get('apachesolr_exclude_node_enable_' . $node->type, 0)) {
    if (isset($node->apachesolr_exclude_node_enabled) && $node->apachesolr_exclude_node_enabled) {
      $apachesolr_path = drupal_get_path('module', 'apachesolr');
      $apachesolr_info = drupal_parse_info_file($apachesolr_path . '/apachesolr.info');
      if (strpos($apachesolr_info['version'], '6.x-3') === 0) {
        $node = node_load($node);
        apachesolr_entity_delete($node, 'node');
      }
      else {
        apachesolr_delete_node_from_index($node);
      }
      return TRUE;
    }
  }
}