浏览代码

推送诊断的语句调优

kongwz 6 年之前
父节点
当前提交
973384374c
共有 2 个文件被更改,包括 17 次插入5 次删除
  1. 2 3
      graph/src/main/java/org/diagbot/graph/jdbc/Neo4jAPI.java
  2. 15 2
      graph/src/main/resources/bolt.properties

+ 2 - 3
graph/src/main/java/org/diagbot/graph/jdbc/Neo4jAPI.java

@@ -663,7 +663,7 @@ public class Neo4jAPI {
             session = driver.session(AccessMode.WRITE);
             logger.info("session 为: " + session);
             //第一步查询是否有组合的词
-            query = propertiesUtil.getProperty("searchCollection").replace("fildList", fildList.toString());
+            query = propertiesUtil.getProperty("searchCollection1").replace("fildList", fildList.toString());
             result = session.run(query);
             while (result.hasNext()) {
                 Record next = result.next();
@@ -694,8 +694,7 @@ public class Neo4jAPI {
             newList.addAll(fildList);
             int i = 0;
             while (newList.size() > 0) {
-                i++;
-                query = propertiesUtil.getProperty("searchCondition").replace("newList", newList.toString()).replace("fildList", fildList.toString());
+                query = propertiesUtil.getProperty("searchCondition1").replace("newList", newList.toString()).replace("fildList", fildList.toString());
                 result = session.run(query);
                 newList.clear();
                 while (result.hasNext()) {

+ 15 - 2
graph/src/main/resources/bolt.properties

@@ -25,6 +25,11 @@ searchCollection=with fildList as data unwind data as row \n \
 match (n)-[r:\u5C5E\u4E8E]->(m)-[r1:\u7EC4\u5408]->(k) \n \
 where n.name= row \n \
 return m.name as condition, count(distinct r)>=m.path as jundgement, labels(m)[0] as label,k.name as standName
+
+searchCollection1=with fildList as data \n \
+match (n)-[r:\u5C5E\u4E8E]->(m)-[r1:\u7EC4\u5408]->(k) \n \
+where n.name in data \n \
+return m.name as condition, count(distinct r)>=m.path as jundgement, labels(m)[0] as label,k.name as standName
 #\u67E5\u627E\u8FD1\u4E49\u8BCD\u7CBE\u534E\u7248
 serchCollect=match (n)-[r:\u8BCA\u65AD\u4F9D\u636E|:\u8FD1\u4E49\u8BCD]->(e) where n.name in fildList return n.name as fild,collect(distinct type(r)) as typeCollect
 #\u67E5\u627E\u80FD\u63A8\u51FA\u8BCA\u65AD\u4F9D\u636E\u7684\u8BCD
@@ -35,10 +40,18 @@ with m,fildList as data unwind data as row\n \
 match (n)-[r:\u8BCA\u65AD\u4F9D\u636E]->(m)\n \
 where n.name= row\n \
 return m.name as condition, count(distinct r)>=m.path as jundgement, labels(m)[0] as label
+
+searchCondition1=with newList as data\n \
+match (l)-[r:\u8BCA\u65AD\u4F9D\u636E]->(m)\n \
+where l.name in data\n \
+with m,fildList as data1\n \
+match (n)-[r:\u8BCA\u65AD\u4F9D\u636E]->(m)\n \
+where n.name in data1\n \
+return m.name as condition, count(distinct r)>=m.path as jundgement, labels(m)[0] as label
 #\u67E5\u627E\u786E\u8BCA,\u62DF\u8BCA\u7684\u8BED\u53E5
-searchQuezhen=with fildList  as data unwind data as row\n \
+searchQuezhen=with fildList  as data\n \
 match (n)-[r:\u786E\u8BCA|:\u62DF\u8BCA]->(m:Disease)\n \
-where n.name=row\n \
+where n.name in data\n \
 with distinct m,r\n \
 return m.name as name, labels(m)[0] as label,type(r) as relationType