Tire.search index do
query do
filtered do
query { string term }
filter :or, { missing: { field: :group_id } },
{ terms: { group_id: group_ids } }
filter :not { type: "Movie" } if current_user.has_not_permission("Movie")
end
end
end.results
如果用户没有电影许可,我想排除所有电影结果。