function drush_search_api_index in Search API 7
Same name and namespace in other branches
- 8 search_api.drush.inc \drush_search_api_index()
Index items.
Parameters
string|integer $index_id: The index name or id for which items should be indexed.
integer $limit: Maximum number of items to index.
integer $batch_size: Number of items to index per batch.
File
- ./
search_api.drush.inc, line 351 - Drush commands for SearchAPI.
Code
function drush_search_api_index($index_id = NULL, $limit = NULL, $batch_size = NULL) {
if (search_api_drush_static(__FUNCTION__)) {
return;
}
$index_id = !empty($index_id) ? $index_id : NULL;
$indexes = search_api_drush_get_index($index_id);
if (empty($indexes)) {
return;
}
$process_batch = FALSE;
foreach ($indexes as $index) {
if (_drush_search_api_batch_indexing_create($index, $limit, $batch_size)) {
$process_batch = TRUE;
}
}
if ($process_batch) {
drush_backend_batch_process();
}
}