utils = $utils; $this->logger = $logger; } /** * Reindexes parent node for a media. No-op if parent does not exist. * * @param Drupal\media\MediaInterface $media * Media whose parent you want to reindex. */ public function reindexParent(MediaInterface $media) { $parent = $this->utils->getParentNode($media); if ($parent === NULL) { return; } $this->logger->debug( "Re-indexing parent node @nid for extracted text @mid using the search_api", ['@nid' => $parent->id(), '@mid' => $media->id()] ); $parent->original = $parent; search_api_entity_update($parent); } }