function search_api_solr_update_7101 in Search API Solr 7
Implements transition from using the index IDs to using machine names.
File
- ./
search_api_solr.install, line 85
Code
function search_api_solr_update_7101() {
foreach (search_api_server_load_multiple(FALSE, array(
'class' => 'search_api_solr_service',
)) as $server) {
if ($server->enabled) {
$server
->deleteItems('all');
}
else {
$tasks = variable_get('search_api_tasks', array());
$tasks[$server->machine_name][''] = array(
'clear all',
);
variable_set('search_api_tasks', $tasks);
}
$query = db_select('search_api_index', 'i')
->fields('i', array(
'machine_name',
))
->condition('server', $server->machine_name);
db_update('search_api_item')
->fields(array(
'changed' => REQUEST_TIME,
))
->condition('index_id', $query, 'IN')
->execute();
}
return t('The Solr search module was updated. ' . 'Please stop your Solr servers, replace their schema.xml with the new version and then start them again. ' . 'All data indexed on Solr servers will have to be reindexed.');
}