function SearchHelpSearch::updateIndexState
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::updateIndexState()
Updates the 'help_search_unindexed_count' state variable.
The state variable is a count of help topics that have never been indexed.
1 call to SearchHelpSearch::updateIndexState()
- SearchHelpSearch::updateIndex in core/
modules/ search/ modules/ search_help/ src/ Plugin/ Search/ SearchHelpSearch.php - Updates the search index for this plugin.
File
-
core/
modules/ search/ modules/ search_help/ src/ Plugin/ Search/ SearchHelpSearch.php, line 375
Class
- SearchHelpSearch
- Handles searching for help using the Search module index.
Namespace
Drupal\search_help\Plugin\SearchCode
public function updateIndexState() : void {
$query = $this->database
->select('help_search_items', 'hsi');
$query->addExpression('COUNT(DISTINCT([hsi].[sid]))');
$query->leftJoin('search_dataset', 'sd', '[hsi].[sid] = [sd].[sid] AND [sd].[type] = :type', [
':type' => $this->getType(),
]);
$query->isNull('sd.sid');
$never_indexed = $query->execute()
->fetchField();
$this->state
->set('help_search_unindexed_count', $never_indexed);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.