File tree Expand file tree Collapse file tree
llama-index-coordinode/llama_index/graph_stores/coordinode Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -147,9 +147,13 @@ def get_rel_map(
147147 dst_data = row .get ("m" , {})
148148 src_id = str (row .get ("_src_id" , "" ))
149149 dst_id = str (row .get ("_dst_id" , "" ))
150- # Variable-length path r returns a list; take first rel type as label .
150+ # Variable-length path [r*1..N] returns a list of relationship dicts .
151151 rels = row .get ("r" , [])
152- rel_label = str (rels [0 ]) if isinstance (rels , list ) and rels else "RELATED"
152+ if isinstance (rels , list ) and rels :
153+ first_rel = rels [0 ]
154+ rel_label = first_rel .get ("type" , "RELATED" ) if isinstance (first_rel , dict ) else str (first_rel )
155+ else :
156+ rel_label = "RELATED"
153157 src = _node_result_to_labelled (src_id , src_data )
154158 dst = _node_result_to_labelled (dst_id , dst_data )
155159 rel = Relation (label = rel_label , source_id = src_id , target_id = dst_id )
You can’t perform that action at this time.
0 commit comments