Search list from list in bubble

I used Bubble to create a blog where each post has tags stored as a list in the “post” data type. On the post page, I wanted to display related posts based on the tags of the current post. To achieve this, I created a repeating group. However, when setting the data source for the repeating group, I encountered an issue because both the “tags” field and the “current post’s tags” are lists. How can I solve this problem? my constraint: Do search for post that “tags” contain “current post’tags”

RG source will be Current Page Post's tags if you are adding tags section on a post page. Or If you have a RG with posts - add a nested RG in the first cell and current cell's post's tags

Thank you for your reply. Instead of displaying all posts with their tags, I would prefer to show related posts based on similar tags. For instance, if we have three posts: post1 with tags (tag 1, tag 2, tag 3), post2 with tags (tag 1, tag 2), and post3 with tags (tag 4). In this example, when viewing post1, I would like to display post2 as a related post due to the presence of similar tags with post1.

With your current setup you’ll need to use an advanced filter to compare the two lists using a :contains list or an :intersects with operator (depending exactly on what you’re trying to do).

But bear in mind, using an advanced filter this way requires that the entire list of Posts from your database is loaded to the page, as the filtering is done client-side… this might be fine if your Post database is small, but if you have thousands of posts it will be too much data, so this is not scalable.

If you need it to be more scalable, you can try offloading the search and filtering to the backend, or perhaps look at using a joining table instead of a list of tags on the Post datatype.

I appreciate your assistance @adamhholmes. Your guidance has been incredibly valuable.

This topic was automatically closed after 70 days. New replies are no longer allowed.