Auto-suggest, or autocomplete, provides a site visitor with suggestions for what queries to try. This saves time, helps avoid typos, and gives visitors new ideas about what to search for. For Drupal projects, there are two auto-suggest mechanisms to choose from. They use different request-count behavior:
- The SearchStax Site Search solution's Auto-Suggest feature offers historical queries that have produced click-through events in the past. SearchStax Auto-Suggest does not count as a search request.
- Drupal also has its own Search API Autocomplete module, which queries the Solr index for matches and near-matches to the user's query. Other autocomplete methods may count as search requests when they send search queries to SearchStax.
Auto-Suggest (Site Search)
SearchStax Auto-Suggest does not count as a search request. It uses the Auto-Suggest API to return suggested queries from your Site Search app's suggestion data, rather than sending a Search API request for each typed character.
See the following pages for more information on the Site Search Auto-Suggest feature:
- Auto-Suggest feature in Site Search
- Site Search Service Limits
- Auto-Suggest Troubleshooting
- Auto-Suggest API
Autocomplete (Drupal)
Autocomplete and Search Request Usage
Drupal autocomplete implementations can send Search API queries as users type. Other autocomplete methods may count against search request usage when they send search queries to SearchStax. Review your implementation and plan capacity before enabling autocomplete options that query the search index.
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.
- In Site Search, go to App Settings > All APIs > Search & Indexing.
- 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 - 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 - 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.
- 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:
- 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.
- 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.
- 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.)
- 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.)