Find items that have at least 1 category from user's selected categories

I have the following data types in my app:

  1. Book
  2. Category
  3. User

Each user has a list of selected categories, and each book has a list of categories. I need to find a book whose category list contains at least 1 category from the current user’s selected categories.

In search Categories only has the following options:

So I did a “search for” categories:

and then an advanced “:intersect with” filter using :filtered:

But this filter is returning no results. Current user has all the categories selected. Each book has some categories selected. But still the intersect is returning no results :thinking:

Any help would be appreciated. Thank you.

Hi there, @deejay.shani… so, first, check your privacy rules because, well, it can almost always be privacy rules.

Second, have you tried the filter without :each item's name? It seems like that shouldn’t be necessary (although, I’m not sure if it matters) if both lists are lists of categories.


Hi @mikeloc . Thanks for the suggestions. I retried after removing all the privacy rules:

And also tried without :each item’s name. Didn’t make a difference. Also, in the debugger I can see that the “Do a search” part is fetching a list of Books, but it’s the :filtered part that then returns zero results.

I could easily be missing something, but it seems to me like it should work. If you want a second set of eyes on it and you are willing to share a read-only link to your editor, I’d be happy to poke around under the hood.

Thank you, Mike. I will inbox you the link shortly, along with a loom video explaining the workflow, the context and the intent :slight_smile:

1 Like

@mikeloc. Sent you the details in inbox :slight_smile:

1 Like