Guides / Getting insights and analytics / Leveraging analytics data

Query Suggestions

Qs example

Query Suggestions is a common search experience that displays an updating list of relevant queries that your users can select from as they type.

These suggestions help users find specific queries that are guaranteed to have results. They also minimize the amount that your users need to type, which can be especially impactful for mobile search.

How Query Suggestions works

Algolia Query Suggestions is implemented through a Query Suggestions index.

  • At each keystroke, your user’s current input is sent as a search to the Query Suggestions index. The index responds with relevant query suggestions, which you can display on your site with some front-end configuration.

  • Your users can then select one of your suggested queries (which dispatches the matching search on your content index), or keep typing and receive new suggestions.

To get a sense of what this looks like, check out our Query Suggestions demo.

Standard and Premium plans give you access to a Query Suggestions tab in your Algolia dashboard. Please reach out to the Algolia Success Team if you have any problems accessing Query Suggestions.

Getting Started with Query Suggestions

To get started with Query Suggestions, you’ll need to think about two very different subjects:

Making a Query Suggestions index

The Query Suggestions index contains vetted query strings with an assigned popularity score. You can quickly create a suggestions index through the dashboard.

Suggestions are determined from your analytics data and your product attributes. If you use Algolia analytics as your data source, then the popularity of a suggestion is the number of times it was searched for over the last 30 days.

Suggestion format, normalization, and completion

We have defined a set of configurable constraints that disqualify certain queries from your suggestion index. Suggestions matching one of these criteria will not be indexed:

  • Suggestion contains non alpha-numeric characters
  • Suggestion does not meet the minimum number of results configured when querying a given source index
  • Suggestion length does not meet the minimum number of letters configured
  • Suggestion matches any of the banned expressions configured

Query suggestions are normalized. For example, consider these four potential suggestions: “tablets”, “Tabl”, “Tablets”, “tablet”. Only one of these suggestions (the one with the most searches on your source index) is kept.

The Query Suggestions feature attempts to complete incomplete words like “Tabl” by looking at the records in your source indices.

Keeping your suggestions up to date

Your suggestions index is automatically kept up to date by your Algolia Analytics data. We rebuild it once every 24 hours or whenever you change and save your suggestion index’s configuration settings.

Suggesting categories and scope

You can also add category information to the records in your Query Suggestions index, letting you suggest categories of products and filters to your users.

Merchandising Suggestions

A Query Suggestion index is a regular Algolia index. As a result, you can leverage existing features such as Rules or Synonyms to customize and boost the relevance of your suggestions.

Whenever your Query Suggestions index rebuilds, it preserves the Rules and Synonyms you’ve added to it.

Using Rules on your Query Suggestions index

By leveraging Rules on your Query Suggestions index, you can entirely customize the relevance of suggestions based on the user’s query or context. You may also choose to apply some Rules globally. A few examples of what you can do with Rules:

  • Change the ranking of suggestions.
  • Change the user’s query.
  • Return custom JSON in the response—to display a banner in a rich autocomplete, for example.

Using Synonyms on your Query Suggestions index

Creating Synonyms on a Query Suggestions index can help users pick a better query. For example, if you have the game listed as “Grand Theft Auto V”, but users often search for “gta v”, you can set a Synonym for them to see “Grand Theft Auto V” as a suggested query.

Displaying Query Suggestions

Once you’ve created your Query Suggestion’s index, you need to implement the front end logic that triggers a search to the index and displays the results. This process and other important implementation considerations are covered in our implementing Query Suggestions guide.

Did you find this page helpful?