Drupal Auto-Suggest

Auto-suggest (or Autocomplete) provides a site visitor with suggestions for what queries to try. This not only saves time and avoids typos but also provides new ideas on what to search for. For Drupal projects, there are two auto-suggest mechanisms to choose from:

  • The SearchStax Site Search solution's auto-suggest feature offers historical queries that have produced click-through events in the past. Therefore, enabling auto-suggest with Site Search can greatly improve your search experience.
  • Drupal also has its own Search API Autocomplete module, which queries the Solr index for matches and near-matches to the user's query.

Auto-Suggest (Site Search)

See the following pages for more information on the Site Search Auto-Suggest feature:

Autocomplete (Drupal)

Autocomplete Impacts Search Service Limits

Each user search triggers multiple Autocomplete queries to the Solr index, resulting in a rapid drain on your Search Service allowance. We suggest that you discuss this with your account manager before enabling this feature.

If you want to add autocomplete to searches provided by Drupal directly, you must have the Search API Autocomplete module installed on your site. After enabling it, configure the Auto-suggest core on the Search API server that uses the SearchStax Cloud with Token Auth connector. You can then configure any search on your site to use auto-suggestions provided by Site Search by following the steps below.

Configure the Auto-Suggest Core in Drupal

The SearchStax Drupal module exposes an Auto-suggest core field on each Search API server configuration to enable SearchStax Auto-Suggest functionality.

Go to Configuration > Search and metadata > Search API > Servers in Drupal. Edit the Search API server that uses the SearchStax Cloud with Token Auth connector. In the Auto-suggest core field, enter or select the core name from your Auto-Suggest endpoint, then click Save.

  1. In Site Search, go to App Settings > All APIs > Search & Indexing.
  2. Locate the Auto-Suggest API Endpoint. It will appear as a full URL similar to: https://ss123456-domain.searchstax.com/solr/ss123456-APPNAME-suggester-1/emsuggest
  3. Extract the core name from this endpoint. The core name is the path segment before /emsuggest. In the example above, the core name is: ss123456-APPNAME-suggester-1
  4. In your Drupal site, go to Configuration > Search and metadata > Search API > Servers, then edit the server that uses the SearchStax Cloud with Token Auth connector.
  5. Locate the Auto-suggest core field and enter or select the core name (for example: ss123456-APPNAME-suggester-1). Note: Enter only the core name, not the full URL. Click Save.

The Auto-suggest core field may be a Key selector if you are using the Drupal Key module. Select the Key that stores your Auto-Suggest core name. If not using Keys, enter the core name exactly as shown in your Auto-Suggest endpoint.

Configure Drupal Autocomplete Suggestions

After configuring the Auto-suggest core, follow these steps to enable SearchStax Auto-Suggest for your Drupal search pages:

  1. Go to the Administration » Configuration » Search and metadata » Search API configuration page, then proceed to the search index which the search page in question uses and finally to its Autocomplete tab.
  2. There, you see a list of all search pages on your site known to the Search API module. (These are the same ones for which individual analytics keys could be selected above.) If not done already, enable autocomplete for the search in question, then click the Edit button next to it.
  3. On this page, you've many options for customizing autocomplete for this search. To let suggestions be provided by the Studio, check SearchStax as the (or one of the) Enabled suggesters. (If choosing more than one suggester, please also remember to order them as desired with the widget right below the checkboxes.)
  4. Make any other adaptions you want to the autocomplete settings for the search (none of them are specific to SearchStax) and then click Save.

You should now see suggestions when typing into the search’s keywords field, provided by the SearchStax Studio. (On development sites, it could be the case that no suggestions are displayed until enough tracking data, including search result clicks, are available.)

Navigation interface showing the autocomplete configuration panel for the Default content index with search pages and operations settings.
Figure 7: Go to the Autocomplete tab of your search index, then enable autocomplete for the search in question and click Edit.
Configuration page for search autocomplete settings showing suggester plugin options with SearchStax enabled.
Figure 8: Enable the SearchStax suggester to start providing search suggestions from SearchStudio to your visitors.
Articles in this section