Tracker Management
The Search API tracker keeps track of which items need indexing. Sometimes you need to rebuild or reset it.
Rebuild Trackers (Recommended)
Use the OpenSolr rebuild command to rebuild trackers for all indexes on a server:
# Rebuild all indexes on a specific server
drush osrb --server=my_solr_server
# Rebuild a specific index only
drush osrb --index=my_solr_index
Mark All Items for Re-indexing
This marks all items as "needs indexing" without deleting them from Solr:
# Mark all items for reindexing
drush search-api:reset-tracker my_solr_index
# Or use the alias
drush sapi-rt my_solr_index
Clear Index and Rebuild
This deletes all items from Solr and marks everything for re-indexing:
# Clear the Solr index completely
drush search-api:clear my_solr_index
# Or use the alias
drush sapi-c my_solr_index
Check Index Status
# Show status of all indexes
drush oss
# Or use Search API status
drush search-api:status
⚠️ Large Sites
Rebuilding trackers on sites with millions of items can take time and cause
database load. Consider running during off-peak hours.
When to Rebuild Trackers
Always Rebuild When:
- Tracker shows incorrect counts
- Items are "stuck" and not getting indexed
- After major content migrations
- After restoring from backup
- After changing index configuration
Use Reset-Tracker When:
- You want to re-index everything but keep Solr data during the process
- Search should continue working during re-indexing
Use Clear When:
- You want a completely fresh start
- Solr index is corrupted or has stale data
- Changing schema significantly
Tracker Internals
The tracker uses the search_api_item database table to track:
item_id- Entity type and ID (e.g., "entity:node/123:en")index_id- Which index this item belongs tostatus- 0 = needs indexing, 1 = indexed
# Check tracker table directly (for debugging)
mysql -e "SELECT index_id, status, COUNT(*) FROM search_api_item GROUP BY index_id, status;"