function SearchHelpSearch::removeItemsFromIndex
Removes an item or items from the search index.
Parameters
int|int[] $sids: Search ID (sid) of item or items to remove.
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.