You are here

function search_wipe in Drupal 4

Same name and namespace in other branches
  1. 5 modules/search/search.module \search_wipe()
  2. 6 modules/search/search.module \search_wipe()

Wipes a part of or the entire search index.

Parameters

$sid: (optional) The SID of the item to wipe. If specified, $type must be passed too.

$type: (optional) The type of item to wipe.

5 calls to search_wipe()
node_delete in modules/node.module
Delete a node.
search_index in modules/search.module
Update the full-text search index for a particular item.
search_settings_form_validate in modules/search.module
Implementation of hook_validate().
search_wipe_confirm_submit in modules/search.module
Handler for wipe confirmation
system_update_132 in database/updates.inc
1 string reference to 'search_wipe'
node_delete in modules/node.module
Delete a node.

File

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

Code

function search_wipe($sid = NULL, $type = NULL, $reindex = FALSE) {
  if ($type == NULL && $sid == NULL) {
    module_invoke_all('search', 'reset');
  }
  else {
    db_query("DELETE FROM {search_dataset} WHERE sid = %d AND type = '%s'", $sid, $type);
    db_query("DELETE FROM {search_index} WHERE fromsid = %d AND fromtype = '%s'", $sid, $type);

    // When re-indexing, keep link references
    db_query("DELETE FROM {search_index} WHERE sid = %d AND type = '%s'" . ($reindex ? " AND fromsid = 0" : ''), $sid, $type);
  }
}