Back to top

Query Tagging and Query Suggestions for Search in Mobile Apps

Search for Mobile Apps - A Blog Series

Kristy Martin
Kristy Martin
Functional & Industry Analytics Consultant

Welcome to the second article in our Search for Mobile App series!

To recap, our first blog discussed why a search box was not all that was needed to bring a “best-in-breed” search experience to your mobile app users; I also provided some ideas on how to get started on improving the basic search experience. 

Now that you’ve been given some thoughts into simplifying your search, optimizing your content, and making the existing abilities of mobile devices work for you, let’s move onto other more advanced options you can take to further enhance search within your mobile app: query tagging and query suggestions.


Tagging queries

The basics of search content processing include stemming root words, expanding words via lemmatization, implementing synonyms, and tokenization. These techniques can be very powerful, but they do not identify user intent.

By combining search analysis with a process we call query tagging, you can match your users’ query terms with patterns and literals to identify their intent. Once you know what they’re looking for, based on the terms entered and your own analysis and tag definitions, query processing and the app’s user interface (UI) can act on your tags to provide customized results, such as filtering out certain results, boosting marketing pages, and controlling UI display.

Tags and associated business rules are defined by you, not by the search engine. The engine gives you relevant results, but you should decide how best to serve these to your users. Since you know your customers better than anyone, this gives you flexibility to customize and enhance their search experience inside your mobile app.

To improve the efficiency of future query analysis and spot trends in users' behavior, you can track and measure tags’ effectiveness using the methods below.

The tagging workflow can follow four high-level steps.


STEP 1 - Understand the query

The first step involves analyzing your user’s query and assigning it a tag. The tag can have associated synonyms and actions/business rules. For example:

query tagging e-commerceYour top queries can be modeled like this: 5, 5S, 6, 6S, 7, 7S

According to the click-through logs of these queries, users are searching for iPhone models by using these strings. From this, you can discern a pattern that identifies a numeric value paired with an alphabetical character (your pattern could be considerably more complicated than that in order to catch an actual model number). Define a tag like so:

pattern tagging example

The iPhone 7S hasn’t yet been released, but you suspect it will be released soon, so your company has created a marketing page to hype the product and offer a pre-order to your customers. Rather than letting the page come up in the organic search results ranked according to the search engine, you want to boost that page to the very top of the search results. You can define an action for your tag:

action tagging example

Now, when users search on 7S, your pre-order page will load at the top of the search results, above the fold. For mobile apps with the smaller screen space, that is a business critical thing indeed.


STEP 2 - Execute the query

Your user just ran a query: 7S

Your app query processor interprets the query string and any additional action(s) to create the final query for the search engine. In simpler terms, your code is telling your search engine to take the 7S string, identify it as<iPhoneModel>7S</iPhoneModel> and then perform the assigned action on it.


STEP 3 - Display the results

From the user’s perspective, this is a search just like any other search. However, the pre-order page pointer appears as her first result, which should tell her that the iPhone 7S is not out yet, but that she can quickly and easily pre-order directly in your app. How convenient! 


STEP 4 – Keep going!

Your user is also running your app on her iPhone 6S. You can infer that she might be interested in upgrading to a new iPhone model since she bought her current phone two years ago through one of your mobile plans. Set up tags to track user history or pull currently used device data. Then choose actions to promote the best answers to your users. For example, you can display the iPhone 7S pre-order page and a banner promoting an upgrade deal for current customers.


mobile query suggestion exampleWhat are query suggestions?

You say type-ahead, I say query suggestions, they say autocomplete, and the other guys say…

This feature has many names, including auto-suggestion and query completion, but the intent is pretty much the same: as the user enters characters in the search field, a drop-down appears listing terms that might be possible matches to the user’s query. It’s a simple concept, but to do it well, requires careful thought and effort.

This recommendation points directly back to keeping it simple and making it easy for your users to find answers.

Take, for example, a mobile query suggestion design based on work we recently completed for the Library of Congress. To give users fast, easy access to relevant queries and titles that match their interest, the query suggestions are scoped on trending queries already run in the system and titles found within the data. When a user types in mar, a list of related topic suggestions appears in the drop-down menu, as illustrated in the graphic on the right.



Mobile query completion comes with some design challenges. Make it big enough so that your users can easily read the matches and tap on the right one, but it should be small enough to not cover the entire screen. Show enough possible matches to make sure you’re serving your user’s needs, but not so many that the suggestions drops below the fold and forces the user to swipe down to see the rest.

Type-ahead UI comes with special considerations that a type-ahead element on the desktop doesn’t have: the device keyboard, when activated, can take roughly a third of the screen space. That cuts down considerably on the number of suggestions you can present to the user, which leads to the concept of…



query suggestion best practicesTo provide the best suggestions and give your users an idea of what they can expect when they tap a match, scope the matches by your data categories. For example, if the user types golf, these could be the possible matches:

  • golf in All Departments
  • golf in Sporting Equipment
  • golf in Deals of the Day
  • golf in Travel 

Scoping should be based on your top queries as determined by all your users’ recent queries. For example, if results that match golf can be found in your category of “Puzzles” but your top queries for the past six months, for example, weren’t for any of these items, then don’t waste valuable screen space by suggesting your user search for golf in the Puzzles category.

Scoped matches can go above or below the organic phrase matches. It really depends on whether you want to promote the scoping. I recommend scoped matches load above the phrase matches to give your user the opportunity to jump directly to the type of results they want.



Speaking of phrase matches, these should also have the concept of relevancy applied. You wouldn’t want a query that is not often run displayed before a query that is in your top queries, right?

Another key concept for type-ahead is to make sure your suggestions are actually found in your data, i.e., the corpus. You never want your user to tap on a suggestion that you gave them only to be confronted with a “no results found” screen. That’s not giving them answers; that’s giving them frustration.



Those little mobile keyboards are enough to bring a grown man to tears. We’ve all been there, tapping like a maniac trying to get the right character only to keep hitting the wrong one and ending up with a typo. Sometimes we don’t even notice our mistake until the search returns with no results. 

Skip all that by implementing fuzzy searching by letting your search application handle the load and correct the typos on the fly. The suggestions returned would be based off the corrected term, e.g., the user types gokf but the suggestions are based off golf.



Returning to the concept of scoped suggestions, personalize the suggestions to the user by scoping on their device type (or other metrics specific to your users). For example, if the user searches in your app for a charging cable, scope the suggestions to show cables compatible with their device. I recommend loading the personalized matches below the scoped matches.

Including a user’s recent search history in the type-ahead brings value to the user. It allows them to single-tap rather than retyping their terms. And as already stated above, anything to avoid tapping on the mobile keyboard is a plus!



Dedicated and thorough content processing is a requirement in order to produce quality query suggestions. Your content processing or data ingestion process should deduplicate entries, normalize the data, get rid of stopwords and other unwanted terms that could lead to zero-match results, and calculate term frequencies. 

We recommend a standalone open source search engine, such as Solr or Elasticsearch, for flexibility in your query suggestion service. Both support a search schema and query model necessary for this implementation.

Consider using an open source Javascript/JQuery framework to support queries as they’re passed from users through the suggestion service. A reverse proxy implementation will protect your index from malicious queries.

What else can I do?

I’ve introduced you to query tagging and smart query suggestions, but there is so much more that you can do to improve search inside your mobile app.

Check out my third blog to learn about some practical tips for Logging and Analytics for Mobile Apps

-- Kristy