diff --git a/lib/redisgraph/query_result.rb b/lib/redisgraph/query_result.rb index 13ce894..56bf698 100644 --- a/lib/redisgraph/query_result.rb +++ b/lib/redisgraph/query_result.rb @@ -64,7 +64,16 @@ def parse_resultset(response) header.reduce([]) do |agg, (type, _it)| i += 1 el = row[i] - agg << map_scalar(el[0], el[1]) + case type + when 1 # Column of scalars + agg << map_scalar(el[0], el[1]) + when 2 # node + props = el[2] + agg << props.sort_by { |prop| prop[0] }.map { |prop| map_prop(prop) } + when 3 # Column of relations + props = el[4] + agg << props.sort_by { |prop| prop[0] }.map { |prop| map_prop(prop) } + end end end