optimized FILTER clause for flags