generate groonga's query.