Browse Source

查询节点优化

gaodm 5 years ago
parent
commit
d936864a4e
1 changed files with 2 additions and 1 deletions
  1. 2 1
      ltkg-service/src/main/resources/mapper/KgMapper.xml

+ 2 - 1
ltkg-service/src/main/resources/mapper/KgMapper.xml

@@ -26,7 +26,8 @@
     </resultMap>
 
     <select id="getNode" parameterType='com.diagbot.vo.KgQueryVO' resultType="com.diagbot.dto.NodeDTO">
-        Match (n:${labelName}) where n.name STARTS WITH #{inputStr} with collect(n.name) as rows1
+        Match (n:${labelName}) where n.name = #{inputStr} with collect(n.name) as rows0
+        OPTIONAL Match (n:${labelName}) where n.name STARTS WITH #{inputStr} with rows0 + collect(n.name) as rows1
         OPTIONAL Match (n:${labelName}) where n.name CONTAINS #{inputStr} with rows1 + collect(n.name) as rows
         unwind rows as row
         with distinct row as x