Make _build_query() accept dicts as sort values