This guide describes how to configure multiple Drupal sites to use a single SearchStax app, with each site managing its own search index. This approach is recommended for scenarios such as managing separate development, staging, and production environments.
Prerequisites¶
- Install the SearchStax module on all sites.
- Create a SearchStax app before configuration.
- Use Drupal Views for search results pages.
- Ensure that the Server and All Index (also known as Parent Index) have the same name.
- All sites must run the same major version of Drupal (such as 10.x or 11.x).
- Limit the number of connected sites to five within a single SearchStax app.
- Use
curl to clear indexed search data. - Establish an abbreviated naming convention for each site, for example:
SiteA_Dev, SiteB_Dev, SiteA_Test, SiteB_Test.
Configuration process¶
- Log in to the Drupal site and navigate to Configuration > Search and Metadata > Search API.
Locate the SearchStax Server and click Edit.
Click Advanced and confirm that the All index prefix field is empty.
Click Multi-site compatibility and check the box for Retrieve results for this site only.
- Click Save.
On the SearchStax server page, find the Search indexes section and select your search index.
If the index contains zero items, click Index now. Wait five minutes, then click the Edit tab. If all items are already indexed, proceed to the Edit tab.
Click Solr specific index options and expand the Advanced section.
- In the Index prefix field, enter the site abbreviation determined in the prerequisites. Click Save.
- Click Rebuild tracking information and Confirm.
- Click Index now and wait five to ten minutes.
- Go to Configuration > Search and Metadata > SearchStax settings.
- Check the Re-route searches through SearchStudio and Configure searches via SearchStudio boxes.
Under the Which Drupal search settings should be ignored? section, uncheck all boxes.
- Repeat all steps for each additional site to connect to the SearchStax app.
- Use the correct site abbreviation in the Index prefix field for each site.
Test Search Results¶
Confirm that each site displays results only from that particular site.
Manage the All Index¶
After completing the configuration process, your SearchStax app contains three indexes:
- All Index: Contains Solr documents from both Site A and Site B.
- SiteA_Dev Index: Contains Solr documents only from Site A.
- SiteB_Dev Index: Contains Solr documents only from Site B.
If a third site (Site C) must show search results from both Site A and Site B, keep the All Index and connect it to Site C with SearchStax's read-only API endpoint. If Site C is not required, delete the All Index using the SearchStax API:
curl -X POST \
'https://searchcloud-{{region-identifier}}.searchstax.com/{{Number}}/{{Application-ID}}/update?commit=true' \
-H 'Content-type:application/json' \
-H 'Authorization: Token {{Token}}' \
-d '{
"delete": {
"query": "index_id:{{All index machine name}}"
}
}'
Maintenance notes¶