List A contains at least 1 of List B

So, I had a question from a new Bubbler who was trying to do a filter by Tags.

The database thing has a list of tags (they are option sets, but don’t think that is relevant) and the page has a multidropdown of tags.

So the search filter can be done by an Advanced Filter…

this thing’s list of tags : intersects with multidropdowns value : count > 0

The question was “is that really the easiest way” ?

“Contains” doesn’t work because that checks for a single tag.

Have been doing it with count>0 on interspect for years. But wondered if something had come along recently (for each?) that would make it simpler?


That’s a sensitive subject. I wish to have that option as a constraint in the searches.


I convert the list of tags into one text field
and do text contains eg inputs values (or multidropdown triggered text state)


To me, it’s the easiest way, but not the most scalable way. Joining tables are more scalable since you can search them server side. But they bring their own set of issues to work through.

100% agree. I hope Bubble’s development plans involve enabling more search functionality server side.

Interesting… how do you handle a situation where one tag’s word is within another tag? If you have tags for “Dog” and “Dog Days” and “Bad Dog”, would selecting “Dog” return all of them, even though I just want “Dog”?

Here, the best way to store tags in a separate table, I mean, as things - and then you can create a text field that should hold the selected tags with a space separator.

For instance, tables:

  • Tag
    name | text
  • Item
    Tags | List of Tag
    tags_string | text

Dog - id_1
Dog Days - id_2
Bad Dog - id_3

Item A:
tags_string - id_1 id_2 id_3

Item B:
tags_string - id_1 id_2

Item C:
tags_string - id_1

Now, you can use the following search:
Do search for Items where "tags_string" contains keyword(s) "selected_tags_source's unique_id join with ' ' (space)"

So, if a user selects Dog - id_1, the system shows Item A, Item B, Item C
So, if a user selects Dog Days - id_2, the system shows Item B, Item A
So, if a user selects Dog Days - id_2 and Dog - id_1, the system shows Item B, Item A

The thing that I was trying achieve:
If a user selects Dog Days - id_2 and Bad Dog - id_3, the system should show Item B, Item C


how i handle it specifically is that each thing also has a list of categories…
you click categories to add them to selection
so it looks for things whose search text contains input searchs text + whose list of categories contains selected category/categories.

probably above approach is even more elegant as your initial datatype is less crowded due to not having a list of categories in it.
well done

2 Likes and @TipLister thank you for the approaches!

Given how “contains keywords” works, I assume this approach only works in situations where all selected tags (vs. just one) must be in a thing’s list of tags for the thing to be returned.

I examined your response more closely,, and I have a few questions…

Makes sense.

I don’t understand. Why would Item C be shown? It does not contain id_2. :confused:

Why would Item C be shown if it does not contain id_2? :confused:

Item C contains neither id_2 nor id_3. Why would it be shown? :confused:

Thanks for the clarification.


1 Like

I find it helpful to think of the desired behavior from the end user’s perspective. Typically, the end user will want to do one of the following in a given search…

  • Find items which contain all of the selected tags
  • Find items which contain any of the selected tags

(A single selected tag would return the same result for either.)

If I understand correctly, the approaches described in this thread thus far seem to address the latter scenario. @NigelG’s approach does it client-side, whereas’s approach does it server-side (at least I think that’s the intent - I’m awaiting clarification).

The above was incorrect. In fact, @NigelG’s client-side approach addresses the latter scenario (show items which contain any of the selected tags), whereas’s server-side approach addresses the first scenario (show items which contain all of the selected tags).

It would be really nice if there was a simple way to accommodate each of the above scenarios server-side. Why can’t it be as simple as contains all of list and contains any of list operators?



Sorry for the confusion. I’ve updated my comment. :sweat_smile:

I’ve built a quick demo:



Thanks much! I see now that your approach is showing only items which have all of the selected tags - not any of the selected tags.

However, I think the last example in your post is incorrect…

I believe that would show only Item A as depicted in your vid.

That indeed appears to be the case. I will amend my other comment to reflect this and avoid further confusion.


1 Like

Here, I mean that it was something that I was trying to achieve, but without any luck (making it work on the server-side).

1 Like

Unless I’m missing something, I think you’d want both a list and a “tag string”, so the data type would actually be heavier (although not by much). Otherwise, it would be a challenge to add/remove tags, whereas it’s trivial to regenerate the delimited tag string from the list when tags are added or removed.


Ah, ok. Got it! Thanks for taking the time to clarify.

FWIW, if anyone stumbling upon this thread feels (like I do) that this could (and should) be a whole lot easier in a no-code environment like Bubble, please take a moment to upvote my feature suggestion in the Ideaboard.

You’ll have to search for “server-side constraints” to find it, as there’s apparently no way to link directly to an item in the Ideaboard. :neutral_face:



Upvoted. For those looking for it, I believe the idea is titled: Search constraint “contains list” server-side


And here’s the direct link:

Do upvote, ye bubblers, so we don’t have to create unnecessary data types and jump through hoops to do basic things such as complex server side searches!