add as_query method