Refactor filtering to fix rate bug for search results