protected function ConfigEventsSubscriber::invalidateSearchIndices in Open Social 10.0.x
Same name and namespace in other branches
- 8.9 modules/social_features/social_profile/modules/social_profile_privacy/src/EventSubscriber/ConfigEventsSubscriber.php \Drupal\social_profile_privacy\EventSubscriber\ConfigEventsSubscriber::invalidateSearchIndices()
- 8.7 modules/social_features/social_profile/modules/social_profile_privacy/src/EventSubscriber/ConfigEventsSubscriber.php \Drupal\social_profile_privacy\EventSubscriber\ConfigEventsSubscriber::invalidateSearchIndices()
- 8.8 modules/social_features/social_profile/modules/social_profile_privacy/src/EventSubscriber/ConfigEventsSubscriber.php \Drupal\social_profile_privacy\EventSubscriber\ConfigEventsSubscriber::invalidateSearchIndices()
- 10.3.x modules/social_features/social_profile/modules/social_profile_privacy/src/EventSubscriber/ConfigEventsSubscriber.php \Drupal\social_profile_privacy\EventSubscriber\ConfigEventsSubscriber::invalidateSearchIndices()
- 10.1.x modules/social_features/social_profile/modules/social_profile_privacy/src/EventSubscriber/ConfigEventsSubscriber.php \Drupal\social_profile_privacy\EventSubscriber\ConfigEventsSubscriber::invalidateSearchIndices()
- 10.2.x modules/social_features/social_profile/modules/social_profile_privacy/src/EventSubscriber/ConfigEventsSubscriber.php \Drupal\social_profile_privacy\EventSubscriber\ConfigEventsSubscriber::invalidateSearchIndices()
Invalidates the search indices for every index that uses profile data.
Throws
\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
\Drupal\Component\Plugin\Exception\PluginNotFoundException
\Drupal\search_api\SearchApiException
1 call to ConfigEventsSubscriber::invalidateSearchIndices()
- ConfigEventsSubscriber::configSave in modules/
social_features/ social_profile/ modules/ social_profile_privacy/ src/ EventSubscriber/ ConfigEventsSubscriber.php - React to a config object being saved.
File
- modules/
social_features/ social_profile/ modules/ social_profile_privacy/ src/ EventSubscriber/ ConfigEventsSubscriber.php, line 101
Class
- ConfigEventsSubscriber
- Class ConfigEventSubscriber.
Namespace
Drupal\social_profile_privacy\EventSubscriberCode
protected function invalidateSearchIndices() : void {
// If the search api module is not installed we have nothing to do.
if (!$this->moduleHandler
->moduleExists('search_api')) {
return;
}
// We load all indexes, we assume there will never be hundreds of search
// indexes which would create its own problems for a site.
$indexes = $this->entityTypeManager
->getStorage('search_api_index')
->loadMultiple();
/** @var \Drupal\search_api\IndexInterface $index */
foreach ($indexes as $index) {
// Check if the search index has profile entities as data source.
if ($index
->isValidDatasource('entity:profile')) {
// Mark any indexed items based on profile entities as having changed so
// they are re-indexed.
$index
->getTrackerInstance()
->trackAllItemsUpdated('entity:profile');
}
}
}