Empty or Insufficient Results
On this page
Getting no results?
Generally speaking, displaying no results gives the impression that your company does not offer what people are looking for. Always displaying results gives the opposite impression: that 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 tend to describe multiple distinct objects versus a unified concept - consider
tables chairs cutleryversus
round outdoor table. The first contains three distinct products, the second only one.
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 also contains an aspect of Query Suggestions.
How to avoid no results
The first step is to review your current solution.
- Rework your content.
- Make sure your search and index settings are optimally configured.
- Use Analytics to see which queries return no results.
The next step is to use some advanced features designed specifically to bring back more results.
Review Your Current Solution
- 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 matter. Don’t be too minimal, include all useful data. Being exhaustive will help users find what they need. You cannot 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.
Algolia offers many settings that help you ensure relevant results for most queries.
Some of the most important are:
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 are consistently getting no results, you might want to re-enable typo tolerance. Recall, you can always disable typo tolerance on 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 title of the film is “Invisible Man”. By removing “The” from the query, the movie will be found.
- Ignoring plurals
This means that singular and plural forms of the same word will find each other, which can increase the result set by a lot. Without this feature, a query with a singular form (“spy”) will not find a record with the plural (“spies”).
Analytics helps you analyze your incoming queries and think about how to get better results. By looking at your top 10 queries*, or the most popular words and phrases, and perhaps most importantly, **which searches return no results, you can make smart choices about your content and your search and index settings. Therefore, you’ll want to make regular use of our Analytics reports.
Advanced Settings to Avoid Insufficient Results
Algolia offers some settings explicitly designed to resolve insufficient results.
- Removing words when no results are found.
- Matching individual words instead of all words in a query.
- Create a list of words that can be removed from a query.
- Adjusting prefix search.
Let’s take them one by one.
Remove Words If No Results
This only works with multi-word queries.
The general idea here is that if the initial query does not 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 of 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.
This impacts ranking: Records that match all three words will be ranked higher than words with only two of the words, 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, can be removed by the engine. The logic is as follows: the engine will run the query with and without the words. This double-query increases the size of the result set.
For example, let’s 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.
This impacts 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.
Adjusting Prefix Search
Prefix matching is central to Algolia’s as-you-type search experience. 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
apr. There’s no need for the engine to wait for a full-word match before displaying results.
This is already useful in avoiding insufficient results. However, 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 be a full match.
For example, the query “ja” will find the sentence “Jack and Jill went up the hill”. But “ja wat” will not. 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 is not possible.
You can fix this and get back 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, be careful, this is not good for 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.