You are here

function apachesolr_nodeapi_update in Apache Solr Search 6.2

Helper function for hook_nodeapi().

2 calls to apachesolr_nodeapi_update()
apachesolr_cron in ./apachesolr.module
Implementation of hook_cron().
apachesolr_nodeapi in ./apachesolr.module
Implementation of hook_nodeapi().

File

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

Code

function apachesolr_nodeapi_update($node, $set_message = TRUE) {

  // Check if the node has gone from published to unpublished.
  if (!$node->status && db_result(db_query("SELECT status FROM {apachesolr_search_node} WHERE nid = %d", $node->nid))) {
    if (apachesolr_delete_node_from_index($node)) {

      // There was no exception, so update the table.
      db_query("UPDATE {apachesolr_search_node} SET changed = %d, status = %d WHERE nid = %d", time(), $node->status, $node->nid);
      if ($set_message && user_access('administer search') && variable_get('apachesolr_set_nodeapi_messages', 1)) {
        apachesolr_set_stats_message('Unpublished content will be removed from the Apache Solr search index in approximately @autocommit_time.');
      }
    }
  }
  else {
    db_query("UPDATE {apachesolr_search_node} SET changed = %d, status = %d WHERE nid = %d", time(), $node->status, $node->nid);
  }
}