function SearchIndexInterface::clear

Same name in other branches
  1. 9 core/modules/search/src/SearchIndexInterface.php \Drupal\search\SearchIndexInterface::clear()
  2. 8.9.x core/modules/search/src/SearchIndexInterface.php \Drupal\search\SearchIndexInterface::clear()
  3. 10 core/modules/search/src/SearchIndexInterface.php \Drupal\search\SearchIndexInterface::clear()

Clears either a part of, or the entire search index.

This function is meant for use by search page plugins, or for building a user interface that lets users clear all or parts of the search index.

Parameters

string|null $type: (optional) The plugin ID or other machine-readable type for the items to remove from the search index. If omitted, $sid and $langcode are ignored and the entire search index is cleared.

int|array|null $sid: (optional) The ID or array of IDs of the items to remove from the search index. If omitted, all items matching $type are cleared, and $langcode is ignored.

string|null $langcode: (optional) Language code of the item to remove from the search index. If omitted, all items matching $sid and $type are cleared.

Throws

\Drupal\search\Exception\SearchIndexException If there is an error clearing the index.

File

core/modules/search/src/SearchIndexInterface.php, line 61

Class

SearchIndexInterface
Provides search index management functions.

Namespace

Drupal\search

Code

public function clear($type = NULL, $sid = NULL, $langcode = NULL);

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.