Apply ACL restriction filters for a search query

These two lines are too complicated IMO