How to exclude a node from being indexed based on a field value? I would like to exclude some nodes from being indexed based on one field value (not content-type) on a drupal 7 installation, I can't find a hook letting me doing it, please help ! thank you
As said in the API, using hook_search_api_index_items_alter is not the best choice.
You should use hook_search_api_alter_callback_info

Example :

function mymodule_search_api_alter_callback_info() {
  $callbacks['exclude_some_nodes'] = array(
    'name' =&gt; t('Exclude some nodes'), 
    'description' =&gt; t('Exclude some nodes from being indexed based on one field value'),
    'class' =&gt; 'SearchApiExcludeSomeNodes',
  );
  return $callbacks;
}

class SearchApiExcludeSomeNodes extends SearchApiAbstractAlterCallback {

  public function supportsIndex(SearchApiIndex $index) {
    return $index-&gt;getEntityType() === 'node';
  }

  public function alterItems(array &amp;$items) {
    foreach ($items as $k =&gt; $item) {
      if($item-&gt;field_your_field['und'][0]['value'] == 'do_not_index') {
        unset($items[$k]);
      }
    }
  }

}


This will appear as an option in the UI of Search API, in the Data alterations section (admin/config/search/search_api/index/your_index/workflow)