function HelpSearch::removeItemsFromIndex
Same name in other branches
- 9 core/modules/help_topics/src/Plugin/Search/HelpSearch.php \Drupal\help_topics\Plugin\Search\HelpSearch::removeItemsFromIndex()
- 8.9.x core/modules/help_topics/src/Plugin/Search/HelpSearch.php \Drupal\help_topics\Plugin\Search\HelpSearch::removeItemsFromIndex()
- 11.x core/modules/help/src/Plugin/Search/HelpSearch.php \Drupal\help\Plugin\Search\HelpSearch::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 HelpSearch::removeItemsFromIndex()
- HelpSearch::updateIndex in core/
modules/ help/ src/ Plugin/ Search/ HelpSearch.php - HelpSearch::updateTopicList in core/
modules/ help/ src/ Plugin/ Search/ HelpSearch.php - Rebuilds the database table containing topics to be indexed.
File
-
core/
modules/ help/ src/ Plugin/ Search/ HelpSearch.php, line 493
Class
- HelpSearch
- Handles searching for help using the Search module index.
Namespace
Drupal\help\Plugin\SearchCode
protected function removeItemsFromIndex($sids) {
$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.