search_wipe

Definition

search_wipe($sid = NULL, $type = NULL, $reindex = FALSE)
search/search.module, line 264

Description

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.

Code

<?php
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);
  }
}
?>