Force Search API To Reindex a Node / an Entity

Public

This is a snippet from my blog post on How To Force Search API To Reindex a Node / an Entity: http://timonweb.com/how-to-force-search-api-to-reindex-a-node-an-entity

Get raw version
php
  1. search_api_track_item_change('node', array($nid));

In some cases, it's worth to clear field_cache for an entity before sending it to reindex:

Get raw version
php
  1. // Clear field cache for the node.
  2. cache_clear_all('field:node:' . $nid, 'cache_field');
  3.  
  4. // Reindex the node.
  5. search_api_track_item_change('node', array($nid));