basic autocomplete framework

Autocomplete- How it works?

Rate this article

Share this article

What is autocomplete?

Autocomplete is an important feature in search engines. It is used to predict the search query a user is typing based on search history log, search terms popularity and individual interests.


Autocomplete is a user interface feature that offers the user a list of words after one or more letters have been typed. The user’s incomplete input is often called a query prefix and the suggested queries are often called query completions. These Autocomplete often starts with the characters that the user has entered into the search box and are adjusted as the user continues typing.  It helps to avoid possible spelling mistakes, especially on devices with small screens.

Why is search autocomplete important?

  1. Increased speed of content discovery.
  2. Lesser spelling errors while searching.
  3. Makes product discovery easier in smaller screens.- Due to the difficulty of entering queries on mobile devices with small screens, on an average, it takes a mobile user approximately 60 seconds to enter a query from a 9-key keypad although the average length of mobile queries is 2.3 words and 15.5 characters
  4. Autocomplete helps people express their intent.
  5. Improves the user search experience.
  6. Discovering relevant search terms.

A simplistic look at how to autocomplete works-

Autocomplete’s main job is to rank suggestions. Given a prefix, possible autocomplete suggestions are ranked according to a predefined criterion, and then some of them are returned to the user.

Autocomplete how it works

Typically, a precomputed auto-completion system is required for generating query completions corresponding to each specific prefix in advance; it stores the associations between prefix and query completions in an efficient data structure, such as prefix-trees, that allows efficient lookups by prefix matching.

This index is similar to an inverted table storing a mapping from query to documents in an information retrieval system.

As users’ queries and interactions can be recorded by search engines, this kind of data is used for generating an index table offline; it captures the relationships between prefixes and queries.

When a user enters a prefix in the search box, based on a pre-built index list of query completions is retrieved. Based on further re-ranking using signals determined at query time, e.g., time, location and user behavior, the user will receive a final list of query completions.

Time-sensitive query auto-completion models

Time-sensitive autocomplete models are of three types-

  1. Short Range- They are easy to implement. Sensitive to recent trending events. They require recent search logs, i.e., search history in a recent period before querying time.
  2. Long Range-They give clear search intent of popular search topics but have difficulty in dealing with new search queries. It also has a larger data storage requirement.
  3. Hybrid of both short and long-range- Based on various implementations, this seems to perform the best among the above three methods.

Generally speaking, more work has been published on the use of recent evidence than on the long-term search history for query auto-complete. Autocomplete models that combine both short-term observations (ongoing trend) and long-term observations (periodic phenomena) achieve the best performance in terms of query completion ranking, and autocomplete models only based on a long-term aggregated frequency are worse than those that only exploit more recent data.

User-centered query autocomplete models

User activities recorded in browsers have been used extensively to create a precise picture of the information needs of users; this concerns both longterm browsing logs and short-term search behavior. Such data has become an important resource for search personalization.

As illustrated in the below figure, personalized autocomplete may interleave the most popular query completions with completions that a user has submitted in the past as query candidates for that particular user. As the two queries “ieee transactions on knowledge and data engineering” and “ieee member” have been issued before, they are ranked at the top positions of the list of suggested query completions in the personalized option.

autocomplete personalization

The search context to be used for personalization can be collected from the current search session, e.g., the preceding queries.

Alternatively, the search context can also be extracted from a user’s longterm search history, e.g., the most frequently submitted queries of a particular user

A third option is for the search context to be determined by a user’s interactions

The user-centered autocomplete models that we have just discussed mainly explore information from the user’s search context, e.g., previous queries, or the user’s interactions while engaging with autocomplete, e.g., typing and skipping at each keystroke. Search context-based autocomplete models do not need a high-resolution query log dataset to record the user’s sequential keystrokes for specific query completions; however, such data is mandatory in interaction-based autocomplete models.

Learning-based approaches for building Autocomplete-

Learning-based autocomplete approaches mainly focus on extracting useful features to seek a correct prediction of the user’s intended query. Such autocomplete models eventually learn a ranking function from the extracted features.Autocomplete - learning

  • Learning from time-related characteristics for query auto completion: Time-related characteristics used for learning to rank query completions mainly relate to popularity-based features from two sources: previous observations and future predictions. Recently introduced ranking models that incorporate features extracted from user behavior in sessions, i.e., the term-, query- and session-level features, generally achieve better performance than the baseline approaches that represent the state-of-the-art.
  • Learning from user interactions for query auto completions. User-centered features typically originate from one of two sources:
    • from user behavior in search sessions which can capture a user’s search interests and how they change queries during search sessions; or
    • from high-resolution query logs that capture user feedback like query typing, skipping, viewing and clicking as feedback in an entire autocomplete process.

How can you create your own Autocomplete?


Creating your own Autocomplete-

  1. Go to Autocomplete creator
  2. Login with your Gmail id.
  3. Enter your website URL.
  4. Enter your sitemap URL.
  5. Choose your nearest data center.
  6. Initial custom search crawl. Wait for the crawl to complete.
  7. Go to and enable autocomplete (show search dropdown option)enable autocomplete
  8. Test the custom search engine by clicking on the demo icon.
  9. Make the necessary look and feel changes by going to the UI customization section.
  10. Go to the code section and copy the code.
  11. Add it to the head section of your website.
  12. Take live.

Add Autocomplete Search to your website @ 9 USD per month

Are you showing the right products, to the right shoppers, at the right time? Contact us to know more.
You may also like