简体   繁体   中英

Meilisearch Filter Rails Array

I am looking for a better way of filtering an array of values through Maeiliseach using an array. I have users that can have multiple accounts and want to search all of a users accounts inventory. I have indexed the Inventory items.

This what a current do

Inventory.search("",{filter: ['account_id = 4 OR account_id = 5']})

I can use

accounts = user.accounts.pluck(:id) 

to get all the id's. Once I have them I can turn it into a string for answer like this 'account_id = 4 OR account_id = 5'. But seems like that might not be the best way and I am missing something. Any help much appreciated. The documentation didn't seem to have the answer I was looking for but maybe I missed it.

I had the wrong version of pagy that is why I was getting the errors.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM