Loading...

Multi-site configuration with a single SearchStax app

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

  1. Configure the first site

    1. Log in to the Drupal site and navigate to Configuration > Search and Metadata > Search API.
    2. Locate the SearchStax Server and click Edit.

    3. Click Advanced and confirm that the All index prefix field is empty.

    4. Click Multi-site compatibility and check the box for Retrieve results for this site only.

    5. Click Save.
  2. Configure the search index

    1. On the SearchStax server page, find the Search indexes section and select your search index.

    2. 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.

    3. Click Solr specific index options and expand the Advanced section.

    4. In the Index prefix field, enter the site abbreviation determined in the prerequisites. Click Save.
    5. Click Rebuild tracking information and Confirm.
    6. Click Index now and wait five to ten minutes.
  3. Configure SearchStax settings

    1. Go to Configuration > Search and Metadata > SearchStax settings.
    2. Check the Re-route searches through SearchStudio and Configure searches via SearchStudio boxes.
    3. Under the Which Drupal search settings should be ignored? section, uncheck all boxes.

  4. Configure additional sites

    1. Repeat all steps for each additional site to connect to the SearchStax app.
    2. Use the correct site abbreviation in the Index prefix field for each site.
  5. 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

  • Clear and reindex content with the Drupal UI to clear all indexes in the SearchStax app.
  • To clear and reindex content for a single site, use the SearchStax Solr API with curl to delete the specific index. Reference the provided curl example in the documentation.

    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:{{Site Index Prefix}}{{All index machine name}}"
        }
      }'

Did not find what you were looking for?

If this content did not answer your questions, try searching or contacting our support team for further assistance.

Back to Section navigation
Back to Site navigation