Guides / Managing results / Optimize search results

Empty or Insufficient Results

Generally speaking, displaying no results gives the impression that your company doesn’t offer what people are looking for. Always displaying results gives the opposite impression: you have something for everybody and every situation.

Additionally, there are specific use cases where no results are problematic.

  • When users are commonly searching with queries that are more specific than the actual records.
  • When users are consistently getting no results for queries that should return results.
  • When users’ multi-word queries describe multiple distinct objects versus a unified concept - consider tables chairs cutlery versus round outdoor table. The first contains three different products, the second only one.

UI solutions

Here’s what you can do on the UI:

  • Show a set of related but less relevant results.
  • Show a UI-friendly “no results” page, with hints for other queries and a selection of important products.

The first option, How to display results even when there are no results, can also help you think about the second solution, which contains an aspect of Query Suggestions.

How to avoid no results

The first step is to review your current solution.

The next step is to use some advanced settings to bring back more results.

Good data

  • The vocabulary of your content matters, especially its variety and precision. Make sure you vary your descriptions - even restating content if different phrasing and vocabulary could be equally relevant. Try to use words your users will use. Add keywords to records.
  • The number of attributes matters. Don’t be too minimal; include all useful data. Being exhaustive will help users find what they need. You can’t predict the kinds of queries users will make, so you want to cover all possibilities.
  • You can use analytics to see if there are any words and phrases that you could add to your data.

Basic configurations

Algolia offers many settings that help you ensure relevant results for most queries. The following often have the most impact:

  • Synonyms. Supporting a variety of vocabulary is essential to obtain relevant results. Alternative words and spellings are common in every industry, and users have come to expect a search engine to know the lingo.
  • Typo tolerance. If you turn typo tolerance off, you will reduce your results. This is because the search engine will only return exact letter-to-letter matches. If you consistently get no results, you might want to re-enable typo tolerance. You can always turn off typo tolerance for specific attributes.
  • Removing stop words. By removing common words like “the”, “a”, “it”, etc., the search engine will have fewer words to match in a query, thereby increasing the result set. When you enter “The Invisible Man”, you may receive no results because the film’s title is “Invisible Man”. By removing “The” from the query, the user will find the movie.
  • Ignoring plurals. This means that singular and plural forms of the same word will find each other, which can significantly increase the number of results. Without this feature, a query with a singular form (“spy”) won’t find a record with the plural (“spies”).

Using Analytics

Analytics helps you analyze your incoming queries and think about getting better results. By looking at your top 10 queries, the most popular words and phrases, and perhaps most importantly, which searches return no results, you can make intelligent choices about your content and your search and index settings. Therefore, you’ll want to make regular use of the Analytics reports.

Advanced settings to avoid insufficient results

Algolia offers some settings explicitly designed to resolve insufficient results.

Remove words if no results

This only works with multi-word queries.

The general idea is that if the initial query doesn’t return any results, the engine will remove one of the words from the query and redo the search. It will keep doing this until results are found or there are no more words to remove.

Matching individual words

This only works with multi-word queries.

By default, Algolia returns matches that contain all a query’s words:

1
"big hamster wheel" ➡️ "big" AND "hamster" AND "wheel"

Every result has to contain all three words.

You can change this by allowing Algolia to return matches that contain only one of the words.

1
"big hamster wheel" ➡️ "big" OR "hamster" OR "wheel"

Now if you have a record with “big” but not “hamster” or “wheel”, it will still be returned.

Changing this behavior will affect ranking: Records that match all three words will be ranked higher than records with only two, and records with two words are higher than records with only one. This is due to the “Words” criterion in the ranking formula.

Creating a list of optional words

You can create a list of words that, if present in a query, will be removed by the engine. The engine will first run the query with the words and then without the words. This “double-querying” increases the number of results.

For example, say you provide online videos. If users query “action video”, you might want to make “video” an optional word. By doing this, you are asking the engine to execute two separate queries - “action video” and “action” - and then combine them for the ranking.

Changing this behavior will affect ranking: Records that match with all words present are ranked higher than words without the optional words. This is due to the “Words” criterion in the ranking formula.

Prefix matching is central to Algolia’s as-you-type search experience since it enables the engine to start matching records based on partial words.

For example, records containing apricot are returned as soon as a user types a, ap, apr. There’s no need for the engine to wait for a full-word match before displaying results.

Hence prefix matching helps avoid insufficient results, but you can also use prefix matching to bring back even more results. Here’s how.

By default, Algolia uses a “prefix last” logic, where only the last word in a query is treated as a prefix; all other text in the query must fully match.

For example, the query “ja” will find the sentence “Jack and Jill went up the hill”. But “ja wat” won’t. That’s because only the last term, “wat”, will be used as a prefix, and the unfinished “ja” will be required to match as a complete word, which isn’t possible.

You can fix this and get more results by making all text in a query match on prefix. Now “ja wat” will find “Jack and Jill went up the hill” because “ja” matches “Jack”, and “wat” can be ignored.

However, this won’t improve relevance. You’ll only want to do this when you want some randomness or lots of records, and you don’t care as much about relevance. Image search is a good use case, where near matches are desirable.

API Reference QueryType
Did you find this page helpful?