Need help with matching two lists in "Do a search"

Hi everyone,

I am wondering if this problem can be solved with a plugin (ShiftLister, Floppy, DataJedi, Listopia, etc.)

Screenshot 2025-09-01 191330

Screenshot 2025-09-01 191330808×588 26.1 KB

Both “List 1” and “List 2” are lists of texts.
The “contains” constraint here does not work as both sides of the expression are lists.

What I want to do is to filter for cases where List 1 field contains all texts from List 2.

I know I can use :advanced but there may be 10K+ cases in the database and :advanced will be too taxing.

Looking forward to learning the best practices for such situation.
Cheers,
Abdul.

List 2 is in list 1 maybe?

I can recall we could check if something is in something else but not if something contains something else. Not sure about if it respects order tho

1 Like

Unfortunately, in “Do a Search” we don’t get “is in” constraint. The only options are “Contains” , “Doesn’t Contain” and empty/isnt empty. Contains only matches the first item in the list.

List1 Intersect with List2:count is List2:count

It should work! It will be true only if all items in list 2 are contained in list 1

1 Like

We do not get that option in the “Do a Search” parameters.

Oh… now I understood what you are trying to do … A many to many search!

1 Like

Yes, a many to many match within a search.

Ok, so I came to one simple solution…

If you could have, inside each “case” the same list but also the representation of this list as a text, you can use the “contains keyword(s)” to make the Search.

Here is what I have built…

Editor here

The only thing you need to do is, whenever an item is added or removed from your list, you update the string that represents that list.

2 Likes

You can do this with client side :filtered operator after “Do a search for”. It supports …intersect, though it will be executed on client side.

1 Like

Sorry, just read your original post to the end, and seems you are aware of this. :slight_smile:
I doubt that any plugin can solve this as all of them work with client data not with raw server db data.

But if your request is to check whether there is exact match of all strings(not intersect of some): I think you can have one workaround that should actually work on server.
You can have extra field in db that stores all list items as sorted alphabetically joined text, e.g. “ABC,BCD,CDE…”. For Thing 2 list you can have the same.
And after that “Do a search for…” can just have Thing1’s joinedList is Thing2’s joinedList

1 Like

This is a current limitation when we need to use comparisons (filters) of this type, applying constraints at server-level.

I think things like this have been discussed in the past and are recurring. So, if the operators discussed in this thread below were added, it would be very useful. Take the opportunity to vote on this request in the ideaboard.

But the approach used by @rpetribu works well.

2 Likes

Please upvote the idea on the idea board.

The suggestions of a field with a list of text to be a replica of the list of ‘things’ works well enough. Just remember the tradeoffs associated and the need to keep them in sync, neither needs to be a deal breaker.

1 Like

Shame that after all, Bubble is Postgres and we should be able to use all of it

1 Like

Hi Rafael,
Thank you for the great advice and taking the time to build out the demo. It works great.
Sadly Working on complex ideas in Bubble requires us to maintain a whole database of workarounds. This is a nice addition to that database for me :grinning_face::heart:

1 Like

Hey @rpetribu I followed your solution and it works great when the result is what the OP expected.

List 1 field contains all texts from List 2

But I was just trying to use this in a different approach and ran into another limitation.

Basically something like.

List 1 field contains at least one option (text) from List 2

Imagine I have a list of products:

  • Product 1
  • Product 2
  • Product 3
  • Product 4

And each product has a list of categories.

  • Product 1

    • Category A
    • Category B
  • Product 2

    • Category A
    • Category C
  • Product 3

    • Category B
    • Category D
  • Product 4

    • Category A
    • Category D

Even if I create a simple text field to store this as a “list of texts”, and have a multi dropdown as a filter where I select the following options, I’ll get the following result for each case:

Case 1:

Options selected: Category A
Products returned: Product 1, Product 2, Product 4

Case 2:

Options selected: Category A, Category B
Products returned: Product 1

In Case 2, I wanted to return all products that contain one of the two selected options. In this case, all products should be returned, since they all have either Category A or Category B.

Here I’m giving an example with few options, which in extreme cases could be solved with an intersect with for each option. But this becomes impractical when using dozens of options as filter.

Do you or anyone else have any ideas on how to approach these cases?

Thanks in advance!

Hey @Lumyna :waving_hand:

You can achieve this without workarounds…

Do a Search for Procucts
Where
Advanced: This Products Category’s intersect with List 1 : first item is not empty

By doing this, you will return all products that have a list of categories that, when compared to the categories in list1, have at least one similar item.

1 Like

But when using advanced filtering, this will be done on the client side, correct? Is there any way to do this on the server side since the amount of data is large?

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