Add UI and scripting support to embedded queries

Yip +1 for this feature - same sort options like the current search but with a sort parameters in the query.