You are here

function apachesolr_taxonomy in Apache Solr Search 6

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

Implementation of hook_taxonomy().

Mark nodes as needing re-indexing if a term name changes.

File

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

Code

function apachesolr_taxonomy($op, $type, $edit) {
  if ($type == 'term' && $op == 'update') {
    switch ($GLOBALS['db_type']) {
      case 'mysql':
      case 'mysqli':
        db_query("UPDATE {apachesolr_search_node} asn INNER JOIN {term_node} tn ON asn.nid = tn.nid SET asn.changed = %d WHERE tn.tid = %d", time(), $edit['tid']);
        break;
      default:
        db_query("UPDATE {apachesolr_search_node} SET changed = %d WHERE nid IN (SELECT nid FROM {term_node} WHERE tid = %d)", time(), $edit['tid']);
        break;
    }
  }

  // TODO: the rest, such as term deletion.
}