Demo to preview the settings
Introduction
Building a search engine for your website used to be a tedious process. You had to perfect long searches in the Bubble database and worry about the performance.
But now you can search your data in real-time with Algolia without having to worry about any of these issues.
Prerequisites
For using the plugin you'll need to get the API credentials from Algolia. Create your development account at: https://www.algolia.com/developers/
How to setup
1. Log In to the Algolia Dashboard
- Access the Algolia dashboard at Algolia Dashboard and log in to your account.
2. Navigate to the API Keys Section
- From the left-hand menu, go to API Keys.
- Here, you'll find all existing keys, including the default ones like
Admin API Key
andSearch API Key
.
3. Create a New API Key (Optional)
If you want to create a new key with custom permissions:
- Click on Create API Key.
- Fill in the details:
- Description: Provide a name, e.g., "Admin Key for XYZ Project".
- ACL (Access Control List): Select the required permissions. For an Admin Key, enable all permissions:
search
addObject
deleteObject
editSettings
analytics
logs
- Indexes: Specify the indexes this key should apply to, or leave it empty for all indexes.
- Validity: Optionally set an expiration date for the key.
- IP Restrictions: Add IP restrictions for enhanced security (optional).
- Referrer Restrictions: Add referrer restrictions if required.
- Click Save to finalize the creation of the key.
4. Copy the Admin API Key
5. Take the copied keys and go to them in the "Plugin" section of your Bubble application, then configure the keys in the plugin settings.
The Admin API key in Algolia must remain secret and should only be used for data management operations, such as adding, deleting, and updating records. Do not use it for search.
Search-Only API Key.
- Check Existing Keys: You will see several predefined keys, including one labeled Search-Only API Key. This is the search key that should be used in your application for search queries.
- Create a New Key (Optional):
- If you want a custom key:
- Click the Create API Key button.
- Configure the permissions:
- Allow only search operations.
- Set the indexes it can access (optional).
- You can set additional restrictions, such as rate limits or referrer filters.
- Click Save to generate the key.
- Use the Search API Key in Your Application:
- Use this key wherever search queries are needed, ensuring the Admin API Key is not exposed.
Application ID
- Go to the "API Keys" Section:
- Alternatively, you can go to the API Keys section in the left-hand menu. The Application ID will be listed there along with the API keys.
- Use the Application ID in Your App:
- The Application ID is required to establish a connection between your app and Algolia. It is typically used alongside a Search API Key.
2. Creating your first index
If you don’t have a real set of data, you can use Algolia’s sample records (click on the use sample user profile records button). If you have a real set of data, you can import them as JSON or CSV.
3. Your Algolia index
The Algolia indices page shows you the data belonging to your index and allows you to search it in real-time.
For example, you can type Lina in the search input to retrieve all the profiles that contain the word Lina in them.
4. Configuring ranking for your index
Locate the upper tab under your index and select "Configuration" then "Ranking and Sorting" to set up the ranking factors for your search. Algolia offers many ranking factors, we’re going to briefly mention the most important factors. They do have good documentation and decent support if you need to customize your index furthermore.
We suggest you keep the default values for the following fields unless you face any issue with them later on:
- Min chars to accept 1 typo
- Min chars to accept 2 typos
- Allow typos on numeric tokens
- Ignore plural
- Disable typo-tolerance on
- Query words interpretation
- Ranking
Attributes to index: Lets you select the attributes you want algolia to search. For instance, you want to search the email address but never search the home address field.
Custom Ranking: It allows you to specify the popularity of your data. Say the number of followers defines how important a person is, making it more relevant when sorting search results.
Optional words: Whenever you’re searching text or sentences rather than keywords, optional words are the most important configuration. It will instruct the search engine to skip the defined optional words (also known as Stop words).
Optional words are a list of commonly used words (such as “a”, “the”, etc.) that are deemed irrelevant because they occur frequently and matching those words would not make be helpful when aiming to return relevant data.
Here’s a list of stop words for the English language, you can also find the list for other languages.
Synonyms: Synonyms list would be helpful to define equivalent keywords. For instance: “any”, “whatever” and “whatsoever” will be treated as if they were the same word.
Remove words if no results: In most cases, this setting is very useful as Algolia tries to re-run your search during the same API call by removing 1 word at a time.
Use lastWords if you want to remove words from the end of the search query, or firstWords if you want to remove words from the beginning of the search query.
5. Configuring display for your index
We suggest you keep the default values for the following fields unless you face any issue with them later on:
- Max Values Per Facet
- Unretrievable attributes
- Attributes to snippet
- Replace synonyms in the highlight
- Highlight prefix tag
- Highlight postfix tag
- Attribute for distinct
- Distinct
Attributes for faceting: Faceting is a very useful feature offered by Algolia. It lets you categorize your data according to a certain field. For instance, you can categorize the data by company, language or country.
Hits per page: Like many other configuration options, the “hits per page” can be overridden at query-time. Meaning that when you send the request to Algolia using their API, you can provide a new value that will override the one saved in your index settings. This setting is used to specify the number of results to show per page.
Attributes to retrieve: Defines the attributes you want to retrieve, by default it returns all attributes.
In order to have the filtering option from „Algolia Search” element working it is needed to set up filtering and faceting in Algolia Dashboard.
Steps for setting up filtering and faceting:
1. Open the Search tab in your Algolia dashboard, and find tab "Configuration".
2. Select “Searchable attributes” and add there all the needed attributes by which you want to filter.
3. Select “Facets” and add there all the needed attributes by which you want to filter.