ソースを参照

修复data_lable list api

wangxq 1 ヶ月 前
コミット
479e57adbb
1 ファイル変更6 行追加2 行削除
  1. 6 2
      app/core/data_interface/interface.py

+ 6 - 2
app/core/data_interface/interface.py

@@ -283,8 +283,12 @@ def label_list(skip_count, page_size, en_name_filter=None,
     cql = f"""
     MATCH (n:data_label)
     WHERE {where_str}
-    RETURN properties(n) as properties,n.time as time,elementId(n) as nodeid,
-           COUNT((()-[]->(n))) + COUNT(((n)-[]->()))  as relationship_count
+    WITH n, properties(n) as properties, n.time as time, elementId(n) as nodeid
+    OPTIONAL MATCH (n)<-[r]-()
+    WITH n, properties, time, nodeid, count(r) as incoming
+    OPTIONAL MATCH (n)-[r]->()
+    WITH n, properties, time, nodeid, incoming, count(r) as outgoing
+    RETURN properties, time, nodeid, incoming + outgoing as relationship_count
     ORDER BY time desc
     SKIP $skip_count
     LIMIT $page_size