Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. HelpSearch.php

function 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
Updates the search index for this plugin.
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\Search

Code

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

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal