Filter search by any of tags in array? (OR-operator?)


We’ve got a search widget that is supposed to search for our customers. Each customer can belong to many locales, but not all admins have access to information on each locale.

Our issue begins where we try to setup the search.

# locale_filter is an array of all the locales the admin have access to: ["locale_1", "locale_2"]
hits =, { tagFilters: locale_filter })

This results in that customers only tagged with one of the locales are missed out - the only customers shown are those that are tagged with all the locales the admin has access to.

What we need to figure out is how we can search by matching ANY of the locale_filters to the user. How does one go about that?

Found the solution myself. It wasn’t available in the rails docs however. All I had to do was to wrap the locale_filter array in another array:

hits =, { tagFilters: [locale_filter] })