function commerce_kickstart_update_7209 in Commerce Kickstart 7.2
Check and remove sorts on non indexed fields.
File
- ./
commerce_kickstart.install, line 1026 - Installation code for Commerce Kickstart.
Code
function commerce_kickstart_update_7209() {
if ($index = search_api_index_load('product_display')) {
$fields = $index->options['fields'];
$query = new EntityFieldQuery();
$query
->entityCondition('entity_type', 'search_api_sort')
->propertyCondition('field', array_keys($fields), 'NOT IN');
$results = $query
->execute();
if (!empty($results['search_api_sort'])) {
entity_delete_multiple('search_api_sort', array_keys($results['search_api_sort']));
}
}
}