Reputation: 5481
I need to exclude records from searchkick when it has less than 3 tags. Right now, my search_data function is as follow:
def search_data
{
...
tag_ids: tags.map(&:id)
}
end
Can I do this?
def search_data
return nil if tags.count < 3
{
...
tag_ids: tags.map(&:id)
}
end
Or can I add some condition when I perform lookup(), so it only search records that have tag_ids array with 3 or more id? (Other than add a tag_count field and reindex everything?)
Thanks!
Upvotes: 0
Views: 915