Switch from Drupal's Search API Autocomplete to SearchStax Auto-Suggest
Learn how to switch from Drupal's Search API Autocomplete module to the more powerful and efficient SearchStax Auto-Suggest.
By the end of this guide, you'll be able to:
- Understand the benefits of switching to SearchStax Auto-Suggest.
- Choose the right method for powering your suggestions.
- Configure Auto-Suggest to provide relevant terms from day one, even without analytics data.
Why Switch to SearchStax Auto-Suggest?
Drupal's Search API Autocomplete module is functional, but it can negatively impact your site's performance and budget. Each character a user types triggers a new query against your index, rapidly consuming your search request quota.
SearchStax Auto-Suggest is a more efficient and powerful solution:
- It preserves your search quota. Auto-Suggest queries come from a separate, optimized endpoint and don't count toward your plan's monthly request limit.
- It's faster. A dedicated suggester index delivers suggestions, resulting in faster response times and a better user experience.
- It gives you more control. You can power suggestions using a custom dictionary that you manage, data from user behavior, or a combination of both.
Choose Your Auto-Suggest Method
SearchStax offers three ways to power your suggestions. You can start with a dictionary and enable data-driven suggestions later if your plan includes Search Analytics.
- Dictionary-Driven (Recommended Starting Point): You provide a list of approved suggestion terms by uploading a simple text file. This method works for everyone, including those on plans without Search Analytics or anyone who wants immediate, predictable suggestions at launch. You'll get complete control over the user experience.
- Data-Driven (Requires Analytics): Site Search automatically suggests terms based on historical user queries that led to clicks. This method works best for mature implementations on plans that include Search Analytics. Suggestions improve automatically as you collect more user data.
- Data + Dictionary-Driven: This hybrid approach combines your custom dictionary with data-driven suggestions. It's best for ensuring a baseline of high-quality suggestions from your dictionary while layering in popular queries from user behavior.
How to Make the Switch
Follow these steps to configure and launch SearchStax Auto-Suggest on your Drupal site.
Prerequisites
Before you start, you'll need:
- A SearchStax Site Search account with an App that includes the Auto-Suggest feature.
- Administrator access to your Drupal site.
- The Search API Autocomplete module installed and enabled in Drupal. You need this module even when using SearchStax Auto-Suggest because it exposes the Auto-suggest core field on the Search API server configuration page that uses the SearchStax Cloud with Token Auth connector. If you haven't installed it yet, run
composer require drupal/search_api_autocompleteand enable the module in your site's module management.
Step 1: Create a Dictionary File from Drupal Titles
To "warm" auto-suggest with relevant terms, create a dictionary file by exporting node titles from your Drupal site. You'll need a plain text (.txt) file with one title per line.
The most common way to do this is to use a Drupal module like Views Data Export, which lets you create a custom export of any data field.
The exact steps vary based on your Drupal version and site configuration. We recommend following the official community documentation for the Views Data Export module. It'll walk you through creating a View, adding the "Title" field, and exporting the data. Save or convert the export to a newline-delimited .txt file before you upload it to Auto-Suggest.
See the Views Data Export documentation on Drupal.org for detailed instructions.
After exporting, review the file to verify it's clean and properly formatted. Once you've got your .txt file of titles, you're ready to configure Auto-Suggest in the Site Search UI.
Step 2: Configure Auto-Suggest in Site Search
Upload your dictionary and enable the feature.
- In the SearchStax Site Search dashboard, go to Auto-Suggest.
- Under the Dictionary-Driven section, click Upload File and select the
.txtfile you created. - Give the dictionary a descriptive name and save it.
- Enable the Auto-Suggest feature at the top of the page.
- Confirm that Dictionary-Driven or Data + Dictionary-Driven is selected as the method and that your newly uploaded dictionary is chosen from the dropdown menu.
- Click SAVE DRAFT, then click PUBLISH to make your changes live.
For more detailed instructions, see the Auto-Suggest configuration guide.
Step 3: Configure the Drupal Module
Configure the SearchStax Drupal module to use your Auto-Suggest endpoint on the appropriate Search API server.
- In the SearchStax Site Search dashboard, go to App Settings > All APIs > Search & Indexing.
- Locate the Auto-Suggest API Endpoint. It will look something like:
https://ss123456-domain.searchstax.com/solr/ss123456-APPNAME-suggester-1/emsuggest - Extract the core name from the endpoint. This is the path segment before
/emsuggest. In the example above, the core name is:ss123456-APPNAME-suggester-1 - 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.
- Find the Auto-suggest core field (this field only appears if the Search API Autocomplete module is installed and enabled). 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.
For additional details, see the Drupal Auto-Suggest setup guide.
Step 4: Test Your Setup
Go to your website's search page and begin typing in the search bar. Confirm that the suggestions from your uploaded dictionary appear as expected.
Troubleshooting
If Auto-Suggest isn't working as expected, review the following:
If the Auto-suggest core field does not appear on the Search API server configuration page:
- Ensure the Search API Autocomplete module is installed and enabled.
- Clear Drupal’s cache.
- Confirm you are editing the correct SearchStax server (SearchStax Cloud with Token Auth).
- Suggestions aren't appearing?
- Confirm that you've entered the correct core name in the Auto-suggest core field on the Search API server configuration.
- Confirm that you've clicked PUBLISH on the Auto-Suggest screen in Site Search.
- If you're using the Data-Driven method, it requires historical search data with click-through events. Suggestions won't appear on a new app until you've collected enough analytics data.
- Seeing irrelevant suggestions?
- If you're using the Dictionary-Driven method, review and clean your uploaded
.txtfile to remove unwanted terms. - If you're using the Data-Driven method, suggestions become more relevant over time as you track more user behavior.
- If you're using the Dictionary-Driven method, review and clean your uploaded