function search_reindex

search_reindex($sid = NULL, $module = NULL, $reindex = FALSE)

Clears a part of or the entire search index.

Parameters

$sid: (optional) The ID of the item to remove from the search index. If specified, $module must also be given. Omit both $sid and $module to clear the entire search index.

$module: (optional) The machine-readable name of the module for the item to remove from the search index.

File

modules/search/search.module, line 310
Enables site-wide keyword searching.

Code

function search_reindex($sid = NULL, $module = NULL, $reindex = FALSE) {
  if ($module == NULL && $sid == NULL) {
    module_invoke_all('search_reset');
  }
  else {
    db_delete('search_dataset')
      ->condition('sid', $sid)
      ->condition('type', $module)
      ->execute();
    db_delete('search_index')
      ->condition('sid', $sid)
      ->condition('type', $module)
      ->execute();
    // Don't remove links if re-indexing.
    if (!$reindex) {
      db_delete('search_node_links')
        ->condition('sid', $sid)
        ->condition('type', $module)
        ->execute();
    }
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!search!search.module/function/search_reindex/7.x