Filtering based query system