I’d like to contribute what I’ve learned about Algolia for anyone else exploring how to add a faster, elastic-style search to Bubble. Added, this now works in bubble (read on).
Algolia = paid tool for indexing and retrieving data through search bar like capabilities. It’s crazy fast. For us, we’re exploring as a way to improve the speed of repeating groups and create a site-wide search-bar.
Basic setup:
- Use Bubble connector to POST and PUT data into Algolia indexes.
- Use Algolia JS libraries, like instantsearch.js, to add search bar capabilities within Bubble.
Major Challenges:
-
Keeping Bubble data in sync with Algolia index. This could be done either by real-time or batch CRUD.
-
Formatting Algolia indexes to enable relationships between what are 2+ source tables in Bubble. For example, if you have a Users and Orders tables in Bubble, can either 1) add a lookup column in the user’s table or 2) flatten the tables into one to maintain the relationship.
Method#1 Post creates two indexes in Algolia
User [ { first_name: Joe, last_name: Bob, OrderIDs: {ID1, ID2, ID3} ]
Orders [ { OrderID: 1, item: Apples, Price: $5 } ]
Method#2 POST is a flatten table to create single index in Algolia.
User-Orders: [ { first_name: Joe, last_name: Bob, OrderID: 1, item: Apples, Price: $5 }]
There are trade offs to each method.
- Setting up a Algolia search-bar and getting the result set back into Bubble… Algolia has a set of JS libraries with widgets to create on page search. It’s custom code, but using @mishav’s tool kit, it’s possible to render the widgets within bubble. This works. Ideally, instead of custom coding how the widget appears on the page, there’d be a way to grab the result-set and make the result-set available to bubble elements, such as a repeat groups. This would greatly reduce the custom code.
For example, I’d was looking for a way to bring these results "Tom Smith, … " into a Bubble so that I can format this data within a bubble repeating group. This would avoid the need to custom code the way the widget looks because we could simply use bubble elements to display the results.
(Image of instantsearch.js widget within our Bubble app.)
Overall impression: Algolia is super fast and affordable. There is definitely overhead to keep Indexes in sync with Bubble DB. The main challenge, and where I got stuck, is how to bring the result-set back and make it available to bubble’s native elements (repeating groups in particular).