You are here

function apachesolr_user in Apache Solr Search 6.3

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

Implements hook_user(). Mark nodes as needing re-indexing if the author name changes.

Performance issue with Mysql To know why PDO in drupal does not support UPDATE and JOIN at once.

See also

http://drupal.org/node/592522

http://api.drupal.org/api/drupal/includes--database--database.inc/functi...

File

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

Code

function apachesolr_user($op, &$edit, &$account) {
  switch ($op) {
    case 'update':
      if (isset($edit['name']) && $account->name != $edit['name']) {
        $table = apachesolr_get_indexer_table('node');
        $query = "UPDATE {{$table}} asn\n          INNER JOIN {node} n ON asn.entity_id = n.nid SET asn.changed = '%s'\n          WHERE n.uid = '%s'";
        $result = db_query($query, array(
          APACHESOLR_REQUEST_TIME,
          $account->uid,
        ));
      }
      break;
  }
}