Refactored query filters.

Change-Id: I8079c1072185d51a12ab22dc0329ba6d877aae99
Merge "Refactored query filters."