This module provides Drush commands to rapidly index with Search API, using multiple CPU cores. It can be quite useful when you have more than 10,000 nodes in your website.

It uses a multi-process approach by spawning parallel Drush workers that handle queues simultaneously, dramatically increasing indexing speed compared to the standard Search API indexing process.

It relies on Drush and a Unix/Linux-based system.

Configuration

Controlling search_api_fast settings (optional):

Drupal 9/10/11 (settings.php or admin/config/search/search-api-fast)

$config['search_api_fast.performance']['index_workers'] = 8;
$config['search_api_fast.performance']['worker_batch_size'] = 100;
$config['search_api_fast.performance']['max_batches_worker_respawn'] = 4;
$config['search_api_fast.performance']['drush'] = '/opt/mycooldrush/drush';

Configuration explanation:
- index_workers: Number of simultaneous workers (should not exceed available CPU cores)
- worker_batch_size: Batch size (items to index per batch)
- max_batches_worker_respawn: Number of batches before worker respawns (affects memory management)
- drush: Path to drush script (optional)

Drupal 7 (settings.php)

$conf['search_api_fast_index_workers'] = 8;
$conf['search_api_fast_worker_batch_size'] = 100;
$conf['search_api_fast_max_batches_worker_respawn'] = 4;

Usage

Run this from the webroot to start indexing:
drush sapi-fast [index-name]

You can monitor workers using 'top' or 'ps -ef | grep drush' to see all workers spawn.

To reindex (mark all items for reindexing first):
drush sapi-fast [index-name] reindex

To clear the index and then reindex:
drush sapi-fast [index-name] clear

See the README.md for detailed documentation and advanced usage options.

Supporting organizations: 
Sponsoring and development

Project information

Releases