Advance query: added ability to provide restriction on top of base query