Optimization in collection filtering