int ArdbServer::GeoSearch(ArdbConnContext& ctx, RedisCommandFrame& cmd) { GeoSearchOptions options; std::string err; if (0 != options.Parse(cmd.GetArguments(), err, 1)) { fill_error_reply(ctx.reply, "%s", err.c_str()); return 0; } ValueDataDeque res; int ret = m_db->GeoSearch(ctx.currentDB, cmd.GetArguments()[0], options, res); CHECK_ARDB_RETURN_VALUE(ctx.reply, ret); fill_array_reply(ctx.reply, res); return 0; }
int Ardb::Sort(Context& ctx, RedisCommandFrame& cmd) { DataArray vs; std::string key = cmd.GetArguments()[0]; SortOptions options; if (!options.Parse(cmd.GetArguments(), 1)) { fill_error_reply(ctx.reply, "Invalid SORT command or invalid state for SORT."); return 0; } int ret = SortCommand(ctx, key, options, vs); ctx.reply.Clear(); if (ret < 0) { fill_error_reply(ctx.reply, "Invalid SORT command or invalid state for SORT."); } else { fill_array_reply(ctx.reply, vs); } return 0; }