Overview
Providing suggestions helps users type longer queries, a good suggestion ensures the best results. It is easy to build an auto-complete experience with appbase.io but popular suggestions allows you to display more specific and popular query suggestions. Similarly, recent suggestions allows you to display user-specific recent suggestions based on configurable settings.
We extract popular suggestions from the Appbase analytics and store them in a separate index named .suggestions
. We populate this index on a daily basis so that your users will see fresh and relevant suggestions at all the times. Below is the representation of how a popular suggestion is stored.
{
"key": "iphone x",
"count": 255
}
Here, the key
represents the suggestion name and count
represents the number of times that particular suggestion has been searched for actively.
Note:
popular suggestions is available as an enterprise feature. You need to have at least
Production-I
plan or anArc Enterprise
plan to avail this.
When to use it?
Popular Suggestions enable offering search suggestions based on actual search queries that your end-users are making. These can be used by itself (popular trends, searches) or alongside other suggestions based on the product data to provide an augmented search-as-you-type experience.
Because popular suggestions roll up the search queries based on the unique occurrences in a period relevant to you, the suggestions index created this way is very fast to query. In addition to the automated job of populating the popular suggestions index daily, you can also add external suggestions from other sources.
Popular Suggestions Preferences
You can set the preferences for popular suggestions from appbase.io dashboard's Recent Suggestions UI under Search Relevancy
section. In addition to setting default preferences, you can use the REST APIs (examples below) and SearchBox UI components available for React, Vue, React Native to customize how popular suggestions appear for your end-users.
Index Time Properties
Blacklist queries
A list of suggestion terms to be ignored when populating the popular suggestions index.
Number of days
Set the duration of days for which to populate the popular suggestions index. Value should be between [1, 90].
Transform Diacritics
When enabled, suggestion terms will be transformed to remove the diacritics from them. For an example, "Crème Brulée" becomes "Creme Brulee".
External Suggestions
You can define the external suggestions in the JSON format, each suggestion must have the key
and count
keys. The value of the count
key determines the popularity of a particular suggestion.
You can check the below example of external popular suggestions:
[
{
"count": 6,
"indices": [
"abc",
"def"
],
"key": "hello"
}
]
Query Time Properties
Filter by minimum count
Set the minimum number of times a term must be searched by users before it is considered. Value should be ≥ 0.
Filter by minimum hits
Set the minimum number of hits that must be returned for a suggestion term to be considered. Value should be between [0, 1000].
Filter by minimum characters
Set the minimum number of characters that must be present for a suggestion term to be considered. Value should be between [0, 32].
Whitelist indices
Only selected indices will be considered to calculate the suggestions.
Size
Set the maximum number of popular suggestions to be displayed. Value should be between [0, 20].
Recent Suggestions Preferences
You can set the preferences for recent suggestions from appbase.io dashboard's Recent Suggestions UI under Search Relevancy
section. In addition to setting default preferences, you can use the REST APIs (examples below) and SearchBox UI components available for React, Vue, React Native to customize how recent suggestions appear for your end-users.
Minimum Characters
Set the minimum number of characters that must be present for a suggestion term to be considered. Value should be between [0, 32].
Minimum Hits
Set the minimum number of hits that must be returned for a suggestion term to be considered. Value should be between [0, 1000].
Size
Set the maximum number of recent suggestions to be displayed. Value should be between [0, 20].
Indices
Only selected indices will be considered to calculate the suggestions.
Frontend Examples
Usage Example With Searchbox
Usage Example With ReactiveSearch
Query suggestions example
Different type of suggestions serve different purpose. ReactiveSearch provides a wide range of suggestions: index, category, popular, recent, etc.
When a user types in the Searchbox
, they get all the types of suggestions. We can differentiate between the suggestions by looking at the _suggestion_type
and _category
properties. The value for both the properties for different type of suggestion is given in the table below.
Type |
_suggestion_type |
_category |
---|---|---|
Index | "index" |
null |
Category | "index" |
<category_name> |
Popular | "popular" |
null |