Adding node into search api solr programatically We are importing large number of data into our drupal website with custom script and we are using Search api and Search api solr module into our website to index and search large number of data.

When we import data using custom script, Search api solr is not fetching this data and new nodes are not indexing into Solr,

If we update the node, its indexing successfully into solr.

I am trying to adding node programatically into solr but its did not work for us.

search_api_track_item_change($type, array($id));


Can anyone suggest me?
Two things first. These two items are purely a suggestion and have no impact on the code samples bellow:


You should post the code that saves your nodes. The Solr API module should automatically pick up nodes when you save and update them (the search_api module code runs when you call "node_save"). It is odd that it doesn't for you.
You should think about running your solr re-indexing operation after you import all of your data. This will speed up your bulk imports and you can schedule the solr re-index via cron or run it via drush.


The following information comes straight from the search_api module. 

These are the pre-conditions for the code examples bellow:


You need to run these after you call the node_save function.
The $type variable refers to the entity type (node, user, term, etc..). In your case it sounds like $type='node'
the $entity variable refers to the node object you're saving. You would pass this object to the node_save($entity) function during the bulk import operation.


If you're inserting nodes:

  $type='node';
  list($id) = entity_extract_ids($type, $entity);
  if (isset($id)) {
    search_api_track_item_insert($type, array($id));
    $combined_id = $type . '/' . $id;
    search_api_track_item_insert('multiple', array($combined_id));
  }


If you're updating nodes:

$type='node';
list($id) = entity_extract_ids($type, $entity);
if (isset($id)) {
    search_api_track_item_change($type, array($id));
    $combined_id = $type . '/' . $id;
    search_api_track_item_change('multiple', array($combined_id));
}