Scenario
An agency wishes to display search options to users as they enter terms into the search box. The suggestions should be related to the title or intent of the user.
Challenge
Search is an important part of government sites. The Search API module and Solr backend is a venerable solution that covers the bases for many applications. However, there is no out-of-the-box solution such as Search API Autocomplete for offering search suggestions.
Solution
This requirement can be satisfied by setting up a View that hooks into the search index and returns values. The search box can be wired up to trigger AJAX requests on the endpoint to return the data. The data returned will in effect be a list of results based on the search term. It will not be performing any “semantic search” to discover the intent or to offer subject suggestions.
Outcome
A reasonable solution can be offered in this case, however, it will lack sophistication compared to other solutions which users will be familiar with. This is because Solr is a search engine that is based on content, rather than semantic concepts.