function SearchHelpSearch::removeItemsFromIndex
Same name and namespace in other branches
- 11.x core/modules/search/modules/search_help/src/Plugin/Search/SearchHelpSearch.php \Drupal\search_help\Plugin\Search\SearchHelpSearch::removeItemsFromIndex()
Removes an item or items from the search index.
Parameters
int|int[] $sids: Search ID (sid) of item or items to remove.
2 calls to SearchHelpSearch::removeItemsFromIndex()
- SearchHelpSearch::updateIndex in core/
modules/ search/ modules/ search_help/ src/ Plugin/ Search/ SearchHelpSearch.php - Updates the search index for this plugin.
- SearchHelpSearch::updateTopicList in core/
modules/ search/ modules/ search_help/ src/ Plugin/ Search/ SearchHelpSearch.php - Rebuilds the database table containing topics to be indexed.
File
-
core/
modules/ search/ modules/ search_help/ src/ Plugin/ Search/ SearchHelpSearch.php, line 423
Class
- SearchHelpSearch
- Handles searching for help using the Search module index.
Namespace
Drupal\search_help\Plugin\SearchCode
protected function removeItemsFromIndex($sids) : void {
$sids = (array) $sids;
// Remove items from our table in batches of 100, to avoid problems
// with having too many placeholders in database queries.
foreach (array_chunk($sids, 100) as $this_list) {
$this->database
->delete('help_search_items')
->condition('sid', $this_list, 'IN')
->execute();
}
// Remove items from the search tables individually, as there is no bulk
// function to delete items from the search index.
foreach ($sids as $sid) {
$this->searchIndex
->clear($this->getType(), $sid);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.