function crm_core_contact_update_index in CRM Core 7
Implements hook_update_index().
File
- modules/
crm_core_contact/ crm_core_contact.module, line 479 - Provides default CRM Core Contact entities and the ability to create more.
Code
function crm_core_contact_update_index() {
$limit = (int) variable_get('search_cron_limit', 100);
$result = db_query_range("SELECT c.contact_id FROM {crm_core_contact} c LEFT JOIN {search_dataset} d ON d.type = 'crm_core_contact' AND d.sid = c.contact_id WHERE d.sid IS NULL OR d.reindex <> 0 ORDER BY d.reindex ASC, c.contact_id ASC", 0, $limit);
foreach ($result as $contact) {
$contact = crm_core_contact_load($contact->contact_id);
variable_set('crm_core_contact_cron_last', $contact->changed);
// Render the contact.
$view = crm_core_contact_view($contact);
$text = drupal_render($view);
// Update index.
search_index($contact->contact_id, 'crm_core_contact', $text);
}
}