Skip to content

Instantly share code, notes, and snippets.

@kerasai
Last active June 27, 2017 22:58
Show Gist options
  • Save kerasai/32cc589dcc18b1f5e35b8c7754f6d702 to your computer and use it in GitHub Desktop.
Save kerasai/32cc589dcc18b1f5e35b8c7754f6d702 to your computer and use it in GitHub Desktop.
Drupal 8, populates the Search API queue for indexing all entities. Needed in cases where the entity does not populate the index queue on its own.
<?php
$index = \Drupal\search_api\Entity\Index::load('index_name');
foreach ($index->getDatasources() as $id => $datasource) {
$index->trackItemsInserted($id, $datasource->getItemIds());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment