function search_api_entity_insert in Search API 7
Same name and namespace in other branches
- 8 search_api.module \search_api_entity_insert()
Implements hook_entity_insert().
This is implemented on behalf of the SearchApiEntityDataSourceController datasource controller and calls search_api_track_item_insert() for the inserted items.
See also
search_api_search_api_item_type_info()
File
- ./
search_api.module, line 868 - Provides a flexible framework for implementing search services.
Code
function search_api_entity_insert($entity, $type) {
// When inserting a new search index, the new index was already inserted into
// the tracking table. This would lead to a duplicate-key issue, if we would
// continue.
// We also only react on entity operations for types with property
// information, as we don't provide search integration for the others.
if ($type == 'search_api_index' || !entity_get_property_info($type)) {
return;
}
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,
));
}
}