Setup

Setting up the Drupal Module is an easy, step-by-step process that you can complete in just a few minutes.

Requirements

The SearchStax module requires two other Drupal modules to work correctly:

  • Search API: Provides a comprehensive way of adding advanced search functionality to Drupal sites.
  • Search API Solr: For using an Apache Solr server (as provided by SearchStax) together with Search API.

Install these two modules before installing the SearchStax module.

Installation

You can install the SearchStax module like any other Drupal module:

  1. Add the module’s code to your Drupal installation. There are multiple ways to do it:
    • Download an archive with the latest release from the module’s project page and then unpack it somewhere inside your Drupal installation’s /modules folder;
    • or use Composer, executing the command: composer require drupal/searchstax.
  2. Then, enable the module, either on Drupal’s Extend page (/admin/modules) or via Drush (drush en searchstax).

Configuration

After enabling the module, you will need to configure a few options to start working with SearchStax and SearchStudio on your Drupal site.

  1. Navigate to the module’s configuration page in one of the following ways:
    • Click on Configure next to the module on the Extend page;
    • Or, navigating to Administration » Configuration » Search and metadata » SearchStax settings on your Drupal site;
    • Or, by entering the URL yoursite.com/admin/config/search/searchstax manually into your browser’s URL bar.
  2. Add configuration information. The configuration page contains the following options (subject to change):
    • Global analytics key: The analytics key to use by default for tracking searches, results clicks, etc. Retrieve it from your SearchStudio account, by navigating to Apps Management and then opening the Analytics API tab.
    • Search-specific analytics keys: In case you have several apps defined in SearchStudio, you can use this section to change the analytics key used for every single search page on your site. (In case a search page is not listed here, its searches will also not be tracked!)
      In case you only have a single search app configured, you can safely ignore this section.
    • Auto-suggest core: (Only displayed if the Search API Autocomplete module is installed on your site.) If you want to use SearchStax’s auto-suggest capabilities, enter the Solr core to use into this field. You can find this in your SearchStudio account, under Apps Management » Search API » Suggest URL. The core is the second to last component – between /solr/ and /emsuggest.
    • Re-route searches through SearchStudio: Enable this option in case you want to use SearchStax’s own handler for search requests instead of the one provided by Search API Solr. If this is disabled and you use Search API (not StudioJS) for creating a search page, most of the search settings in your SearchStudio account will not have any effect.
    • Configure searches exclusively via SearchStudio: If this option is enabled, most search settings configured in Drupal will be ignored and the settings configured in SearchStudio will take effect. This includes, for instance, sorting, searched fields and field boosts. Only fulltext keys, filters, paging parameters and facets will be passed to the Solr server.
    • Configure facets via SearchStudio: (Only displayed after enabling Configure searches exclusively via SearchStudio option): If this option is enabled, facet parameters will also not be sent to the Solr server and the SearchStudio facet settings will be used. This will in most cases not work correctly with the Facets module, so custom code handling the returned facets will be needed. (This setting has no effect if no facets have been configured in Drupal.)
  3. With all of this configured as desired, simply click “Save configuration” to complete the setup.