Value should be X but right now it's a list of X

Hi there! I’m working on a StackExchange clone as practice, and I wanted to add a search function that can filter the questions on the home page by title and tags. When I set the filter by title, there is no problem; it works perfectly fine, but when I try to do the same with tags, I am stuck with this problem:

Value should be Tag (option set) but right now it’s a List of Tag (option set)s

I would be grateful for any help!

Tags (data) is a list field. contains is comparing if your list field contains a single argument.
And you are referencing a multidropdown that stores a list of tags (even if 1 tag chosen there - it’s still a list)

To compare List vs List you can use Advanced: filtering but keep in mind that it is executed client-side (so Bubble will fetch more items including irrelevant and then the list of items will be filter in the browser).

1 Like

Could you please break it down for me what do you mean by advanced filtering?

Something like this:

So we use as much simple constraints in Do a search expression as we can for server-side filtering, then apply :filtered operator where at the bottom there is an Advanced: option.
Within this advanced option we make an expression like This Thing's list of values INTERSECT WITH multidropdown's value:count>0.
The second part OR multidropdown's value:count<1 is used as a replacement of “ignore empty constraints” option that is not available in advanced filtering.

Thank you. Seems like now the tag filter works. But it created another issue.

Scenario: There are 100 questions with different tags. First I use the tag filter. Now there are 25 questions. Then I use the title filter (contains keyword) to find a specific question, but it doesn’t work. I can only filter with tag OR keyword.

Have you added your keyword constraint into Do a search expression that is advanced filtered later?

This is for tags.

This is for titles.

What did I do wrong?
(thank you for your help!)

All constraints should be within 1 search expression.
And you should not to use Advanced for keyword search. Add constraint title contains input search by title's value right into Do a search expression:

P.S. Keep in mind that I’ve used conditional tab because as far as I remember even if advanced filtering element is empty (for example, when multidropdown is empty) - Bubble still loads extra things from DB. Not sure, as I’ve tested it long-long ago :slight_smile:

Yeah. It seems like now Bubble doesn’t load anything from DB when the multi dropdown is empty. Because if I just use the title filter, nothing happens. When I only use the tag filter, it shows 0 results. So this last change just made things worse :confused:

Show your search expression and constraints

First of all, I’m sorry for confusing you with setting data source in “Conditional” tab :slight_smile:
The reason for it is that as far as I remember if advanced filter is used in dynamic expression of the data source - it will lead to client-side filtering even if the list to compare with (from you multidropdown, for example) is empty. That’s a thing to double check cause I’ve tested it long-long ago.

So you need to set up default Data Source (tab “Appearance”) like this (and don’t forget to check “ignore empty constraints” if you need your RG to show Things when 0 filters are applied):

And in “Conditionals” leave your expression as it is, but check “ignore empty constraints” too (in Do a search for constraints window).

Here’s the link so you can try our settings live.

If you filter first with code, there will be two results and then also filter by title ‘Ruby’ let’s just say. It doesn’t filter down to one result.

Here are the settings now.

Have you left title contains input search by title's value in conditional Do a search?

No, but I fixed it and now it works :wink: The problem now is when I filter title with ‘under’ word (two questions contain this keyword) it doesn’t show anything

If you are using ... contains keyword(s):

To emphasize, this operator will ignore any short, common words for the search. These short, common words are known as “stop words”, and an example of such a list (though this is more illustrative, and not the definitive list involved in Bubble’s text searches) can be found here.
Operators and comparisons - Bubble Docs

“under” word is in the list :slight_smile:

Oh okay, that makes sense. Then everything works perfectly fine. Thank you so much for your help! :slightly_smiling_face:

1 Like