function apachesolr_taxonomy_term_update in Apache Solr Search 7
Same name and namespace in other branches
- 8 apachesolr.module \apachesolr_taxonomy_term_update()
Implements hook_taxonomy_term_update().
Mark nodes as needing re-indexing if a term name changes.
Performance issue with Mysql To know why PDO in drupal does not support UPDATE and JOIN at once. @todo the rest, such as term deletion.
See also
http://api.drupal.org/api/drupal/includes--database--database.inc/functi...
File
- ./
apachesolr.module, line 655 - Integration with the Apache Solr search application.
Code
function apachesolr_taxonomy_term_update($term) {
$table = apachesolr_get_indexer_table('node');
switch (db_driver()) {
case 'mysql':
$table = db_escape_table($table);
$query = "UPDATE {{$table}} asn\n INNER JOIN {taxonomy_index} ti ON asn.entity_id = ti.nid SET asn.changed = :changed\n WHERE ti.tid = :tid";
$result = db_query($query, array(
':changed' => REQUEST_TIME,
':tid' => $term->tid,
));
break;
default:
$nids = db_select('taxonomy_index')
->fields('taxonomy_index', array(
'nid',
))
->where("tid = :tid", array(
':tid' => $term->tid,
));
$update = db_update($table)
->condition('entity_id', $nids, 'IN')
->fields(array(
'changed' => REQUEST_TIME,
))
->execute();
}
}