You are here

function apachesolr_nodeapi in Apache Solr Search 5

Same name and namespace in other branches
  1. 5.2 apachesolr.module \apachesolr_nodeapi()
  2. 6.3 apachesolr.module \apachesolr_nodeapi()
  3. 6 apachesolr.module \apachesolr_nodeapi()
  4. 6.2 apachesolr.module \apachesolr_nodeapi()

Implementation of hook_nodeapi().

File

./apachesolr.module, line 480
Integration with the Apache Solr search application.

Code

function apachesolr_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
  switch ($op) {
    case 'delete':
      try {
        $solr =& apachesolr_get_solr(variable_get('apachesolr_host', 'localhost'), variable_get('apachesolr_port', 8983), variable_get('apachesolr_path', '/solr'));
        $solr
          ->deleteById(url('node/' . $node->nid, NULL, NULL, TRUE));
        $solr
          ->commit();
      } catch (Exception $e) {
        watchdog('Apache Solr', $e
          ->getMessage(), WATCHDOG_ERROR);
      }
      break;
  }
}