fold sorted set querying into filter chain