Adds tests for search and improves the performance of group filtering