Reindex a Whole Drupal Site into Solr, Step by Step

osri, ost, oss, and which reset to use

Reindex a whole site

Use this when every document of a server must be built again. Search keeps working the whole time: the old documents stay until the new ones replace them.

  1. See where you start:
    drush oss --server=my_solr_server
  2. Put every item back in the queue. Nothing is deleted from Solr:
    drush osri --server=my_solr_server
  3. Start indexing in the background:
    drush ost --server=my_solr_server
  4. Follow it, with the summary or with the log:
    drush oss
    tail -f /tmp/opensolr_turbo_my_solr_server.log
  5. It is done when drush oss shows 100.0% and remaining 0 for every index, and the log ends with INDEXING COMPLETE.

Just one index

drush osri --index=content_index
drush ost --index=content_index

Which reset to use

drush osri the usual choice

Queues every item the tracker knows. Search keeps the old documents until they are replaced.

Search API's own command for this: search-api:reset-tracker (sapi-r).

drush osrb wrong counts

Rebuilds the tracker from your content, then every item waits. For wrong counts or missing items. Search keeps the old documents until they are replaced.

Search API's own command for this: search-api:rebuild-tracker (sapi-rt).

drush search-api:clear empty first

Deletes every document of the index from Solr and queues every item. Search finds nothing until indexing brings the documents back.

Alias: sapi-c.

The osri and osrb commands work on every enabled index of a server at once; the Search API commands take one index ID, or every index when you leave it out.

Everyday tasks