Best Intersect between 2 lists


I have several “accounts”. Each account has a “list of categories”. I want to select an account and get the other account for which the intersect of their “list of categories” returns the maximum count. However, I’m stuck.

I am able to get a filter in place with the intersect count >0 but am not able to get the account whose list of categories has more in common with the current account.

Can anyone help me out?

1 Like

I too would be interested in this, so that when a user searches for something, they also get “similar to” results. This for me would be a down the road feature, so I haven’t spent any time on it, but I imagine the logic would be something like returning a list of items where categories intersect, and then sorting by a count of the # of intersecting categories. But in Bubble’s “sort by” function, it just provides a list of datatype fields, rather than access to logic. There must be a way though.

Anyone else has their few cents to throw at this? I’ve gone ahead with a workflow of consecutive checkers (if intersect count > 0 = 0, intersect count > 1 = 0, intersect count > 2 = 0, etc) but I’m sure there’s an easier way around this…

Not sure if someone is able to help out with this one. Still trying to find the best option.

Curious if your answer lies somewhere in here.