Glossary

Last updated on
28 September 2017

This section explains some of the module's concepts and components.

"Autocomplete search" config entity

The module uses the "Autocomplete search" config entity type for storing all its configuration. Each entity contains the autocomplete settings for a specific search form on your site. You can use normal configuration management to handle these entities.

An "Autocomplete search" entity is always created for a specific search form, represented by a certain "Search" plugin, with only one entity being allowed for each plugin (so, for each known/supported search form).
As further configuration, it contains configuration for one or more suggester plugins, which will be used for creating the suggestions that will be displayed to the user, as well as a few general options for the autocomplete functionality.

"Search" plugin

The "Search" plugin type is used to identify search forms which support autocompletion. Such plugins are out-of-the-box supplied for all search views and all search pages created with Search API Pages, but other modules can also add support for any other kind of search form (or even forms not created with Search API, if desired).

For each such search plugin, a search entity can then be created to enable autocompletion for that form and further configure how it will work.

"Suggester" plugin

The "Suggester" plugin type encapsulates the logic of how suggestions are created in reaction to user input. Picking the right one(s) for a given search is probably the most important decision in configuring autocompletion. A search can also use a combination of more than one suggester, displaying suggestions from all of them (or just using a second one as a fallback).

The following suggesters are currently available (though more can be added by other contrib modules):

  • Retrieve from server: This suggester will contact the search server with the given user input to determine potential words the user might want to search for. Since this is usually based just on the indexed content, and not the things users previously searched for, suggested additional words might not be relevant for the user, but it's usually pretty good at suggesting possible endings for an incomplete word the user is currently typing.

    This suggesters requires that the server backend supports the search_api_autocomplete feature, so it might not be available in all cases. The default database backend as well as the Solr backend support it, though.

  • Use custom script (hidden by default): This is an option for advanced users, which allows them to specify the URL or server-relative path to a custom script for creating the autocomplete suggestions. This can be used to speed up suggestions by a lot by completely bypassing Drupal (or parts of it), implementing the suggestions in a faster programming language, or retrieving suggestions from an existing source for suggestions (as long as the interface is compatible with jQuery UI Autocomplete).

    For an example of a suggestion script, you can look at the tests/search_api_autocomplete_test/core/custom_autocomplete_script.php file in the module.

    In order to make this suggester available in the UI, edit the site config and set the search_api_autocomplete.settings:enable_custom_scripts setting to true.

Help improve this page

Page status: No known problems

You can: