auto completions: add sorting and support where/orderby