I’m currently doing some testing to determine the best way to achieve something in Bubble (something which is a very common requirement, and should be very simple but, due to some of the limitations of Bubble’s database query functionality, is way more challenging than it should be), and I’d be interested to hear how other Bubble devs have approached this in the past, or any creative ways of achieving it.
The Situation
There’s a Datatype of ‘Tag’ (with approx 100 Tags in the database)
There’s a Datatype of ‘Content’ (with 15,000 entries in the database)
Each Content item can have one or more Tags assigned to it
The Requirement
The requirement is simple:
A user should be able to search for Content items by Tag, by selecting one or more Tags from a multi select dropdown.
There are 2 required use-cases:
- Return ALL Content Items that contain 1 or more of the selected Tags
- Return ONLY Content Items that contain ALL of the selected Tags
In both cases, the Content Item’s Name AND the name of all associated Tags should be displayed on the page.
The Problem
This is an extremely common requirement in any kind of listing app (whether it’s blog posts, products, or any other kind of item that can have associated tags/categories etc.) and yet doing this in Bubble can be very difficult. I’ve seen a lot of apps that try do do this and end up being extremely slow and/or costly in WU.
Doing this in a regular SQL database is both very simple AND fast, and fully scalable (I’ll share some examples later), but because Bubble only provides very basic DB search functionality, I’ve never come across a truly satisfactory way to do this in Bubble.
The Solution
Over the years I’ve seen a number of discussions, on the forum, and elsewhere, about various ways to do this, and I’ve built this type of thing into multiple apps myself with various different approaches - but mostly on fairly small datasets (where the challenges are less noticeable).
If the datasets are small, then there’s not much issue - everything can be done client-side and there’s no real problem. But on a larger database things get more complicated.
So, I’m currently testing multiple approaches for this (about 8 different methods so far) and none of them are truly satisfactory (some are completely un-usable at scale - 2 are working very well, but have some limitations).
So, before concluding my testing and sharing my findings, I’d be interested to know how (if at all) other Bubble devs have approached this challenge (what should be a very simple thing to do).
The solution must:
- Be truly scalable (i.e. work just as well on a database of 100k Content Items as with 100)
- Be reasonably performant (i.e. not take 15 seconds+ to return anything)
- Be reasonably WU efficient
- Preferably allow the User to select any number of Tags to use in the search.
- Preferably also display the total count of matching Content items on the page
- Use the Bubble database
I look forward to seeing some solutions