Sometimes, you may notice that indexing your site has undesired effects on the indexes of other sites in your Site Factory. Incorrect or incomplete results may appear, or you may encounter issues with the pagination of results. The root of the issue is often polluted data within the core, caused by sites sharing the same Solr core, but not having unique hash values to differentiate them.
The site_hash used to be a configuration, it's now a state as per: https://www.drupal.org/project/search_api_solr/issues/2949334
If you want to override/hardcode the site_hash value you need to upgrade to the current dev version of search_api_solr as per: https://www.drupal.org/project/search_api_solr/issues/3252011
You can check the state value for site_hash of your sites like so:
$ drush sget search_api_solr.site_hash --uri=https://www.myfirstexamplesite.com/
[hash value 1] <--- Unique hash value 1
$ drush sget search_api_solr.site_hash --uri=https://www.mysecondexamplesite.com/
[hash value 2] <--- Unique hash value 2
Our recommendation would be to set a unique value in your existing factory-hooks/post-settings-php/includes.php
. You can do that with the following piece of code:
$settings['search_api_solr.site_hash'] = $GLOBALS['gardens_site_settings']['conf']['acsf_db_name'];
If you have overridden the value in settings.php the way to get the real site hash value is:$ drush ev "var_dump(\Drupal\search_api_solr\Utility\Utility::getSiteHash())"
string(15) "overriden_value"
The state value will remain the same.
The code added in the current dev version of search_api_solr for getSiteHash()
will return the value defined in the $settings array if one is defined, else the state value.
Please note that carrying out the above will require you to re-index ALL your sites.
Prior to re-indexing and after you have put the above code in post-settings-php
you will need to completely wipe the index. Should you require further help with that, please file a support ticket.
Bear in mind that the hash will be the same across all your stages, that said as different cores are used for each stage, results will not get mixed up.
Using the $GLOBALS['gardens_site_settings']['conf']['acsf_db_name']
example is just one way of ensuring that your site_hash
is unique. Feel free to use any unique variable you prefer.
If this content did not answer your questions, try searching or contacting our support team for further assistance.
Wed Oct 22 2025 08:59:29 GMT+0000 (Coordinated Universal Time)