You are here

function apachesolr_user_rebuild_index_table in Apachesolr User 6

Truncate and rebuild the apachesolr_search_user table, reset the apachesolr_index_last variable. This is the most complete way to force reindexing, or to build the indexing table for the first time.

1 call to apachesolr_user_rebuild_index_table()
apachesolr_user_enable in ./apachesolr_user.install
Implementation of hook_enable().

File

./apachesolr_user.module, line 115

Code

function apachesolr_user_rebuild_index_table() {
  db_query("DELETE FROM {apachesolr_search_user} WHERE uid IN (SELECT uid FROM {users})");

  // Populate table
  db_query("INSERT INTO {apachesolr_search_user} (uid, status, changed)\n              SELECT u.uid, u.status, %d AS changed\n              FROM {users} u ", time());
  $time = time();
  db_query("UPDATE {apachesolr_search_node} SET changed = %d WHERE changed > %d", $time, $time);
  apachesolr_clear_last_index('apachesolr_user');
}